FaceLandmarks.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { IBoundingBox } from './BoundingBox';
  2. import { Box } from './Box';
  3. import { Dimensions, IDimensions } from './Dimensions';
  4. import { FaceDetection } from './FaceDetection';
  5. import { Point } from './Point';
  6. import { IRect } from './Rect';
  7. export interface IFaceLandmarks {
  8. positions: Point[];
  9. shift: Point;
  10. }
  11. export declare class FaceLandmarks implements IFaceLandmarks {
  12. protected _shift: Point;
  13. protected _positions: Point[];
  14. protected _imgDims: Dimensions;
  15. constructor(relativeFaceLandmarkPositions: Point[], imgDims: IDimensions, shift?: Point);
  16. get shift(): Point;
  17. get imageWidth(): number;
  18. get imageHeight(): number;
  19. get positions(): Point[];
  20. get relativePositions(): Point[];
  21. forSize<T extends FaceLandmarks>(width: number, height: number): T;
  22. shiftBy<T extends FaceLandmarks>(x: number, y: number): T;
  23. shiftByPoint<T extends FaceLandmarks>(pt: Point): T;
  24. /**
  25. * Aligns the face landmarks after face detection from the relative positions of the faces
  26. * bounding box, or it's current shift. This function should be used to align the face images
  27. * after face detection has been performed, before they are passed to the face recognition net.
  28. * This will make the computed face descriptor more accurate.
  29. *
  30. * @param detection (optional) The bounding box of the face or the face detection result. If
  31. * no argument was passed the position of the face landmarks are assumed to be relative to
  32. * it's current shift.
  33. * @returns The bounding box of the aligned face.
  34. */
  35. align(detection?: FaceDetection | IRect | IBoundingBox | null, options?: {
  36. useDlibAlignment?: boolean;
  37. minBoxPadding?: number;
  38. }): Box;
  39. private alignDlib;
  40. private alignMinBbox;
  41. protected getRefPointsForAlignment(): Point[];
  42. }