face-api/src/classes/FaceDetection.ts

25 lines
656 B
TypeScript
Raw Normal View History

2020-08-18 13:54:53 +02:00
import { Box } from './Box';
import { IDimensions } from './Dimensions';
import { ObjectDetection } from './ObjectDetection';
import { Rect } from './Rect';
export interface IFaceDetecion {
score: number
box: Box
}
export class FaceDetection extends ObjectDetection implements IFaceDetecion {
constructor(
score: number,
relativeBox: Rect,
2020-12-23 17:26:55 +01:00
imageDims: IDimensions,
2020-08-18 13:54:53 +02:00
) {
2020-12-23 17:26:55 +01:00
super(score, score, '', relativeBox, imageDims);
2020-08-18 13:54:53 +02:00
}
public forSize(width: number, height: number): FaceDetection {
2020-12-23 17:26:55 +01:00
const { score, relativeBox, imageDims } = super.forSize(width, height);
return new FaceDetection(score, relativeBox, imageDims);
2020-08-18 13:54:53 +02:00
}
2020-12-23 17:26:55 +01:00
}