Files
scrypted/plugins/objectdetector/src/util.ts
2021-11-17 23:33:08 -08:00

13 lines
441 B
TypeScript

import * as faceapi from "face-api.js";
export function makeBoundingBoxFromFace(face: faceapi.WithFaceDescriptor<faceapi.WithFaceLandmarks<{
detection: faceapi.FaceDetection;
}, faceapi.FaceLandmarks68>>
): [number, number, number, number] {
return makeBoundingBox(face.detection.box);
}
export function makeBoundingBox(box: faceapi.Box<any>): [number, number, number, number] {
return [box.x, box.y, box.width, box.height];
}