Types
Face = object x*, y*: float32 scale*: float32 score*: float32
- Face contains the detection results composed of the row, column, scale factor and the detection score. Source Edit
FaceCascade = object codes: seq[int8] preds: seq[float32] thresholds: seq[float32] treeDepth: uint32 treeNum: uint32
- Defines the basic binary tree components for face data. Source Edit
FaceDetector = object faceCascade*: FaceCascade eyesCascade*: LandmarkCascade landmarkCascades*: Table[string, LandmarkCascade]
- FaceDetector is a high-level API for detecting faces, eyes and optionally other landmarks Source Edit
Image8 = object width*, height*: int data*: seq[uint8]
- Image8 is a container for 8-bit grayscale image. width: the number of image rows. height: the number of image columns. data: contains the grayscale converted image pixel data. Source Edit
Landmark = object x*, y*: float32 scale*: float32
- Landmark contains all the information resulted from the pupil detection needed for accessing from a global scope. Source Edit
LandmarkCascade = object codes: seq[int8] preds: seq[float32] treeDepth: uint32 treeNum: uint32 scales: float32 stages: uint32
- Defines the basic binary tree components for landmark data. Source Edit
Consts
eyeCascades = ["lp46", "lp44", "lp42", "lp38", "lp312"]
- Source Edit
mouthCascades = ["lp93", "lp84", "lp82", "lp81"]
- Source Edit
Procs
proc cluster(faces: seq[Face]; iouThreshold: float64): seq[Face] {....raises: [], tags: [].}
- Returns the intersection over union of multiple clusters. We need to make this comparison to filter out multiple face detection regions. Source Edit
proc detect(fc: FaceCascade; image: Image8; minSize: int = 100; maxSize: int = 600; shiftFactor: float64 = 0.15; scaleFactor: float64 = 1.1; angle = 0.0; iouThreshold = 0.0): seq[ Face] {....raises: [], tags: [].}
- Analyze the grayscale converted image pixel data and run the classification function over the detection window. It will return a slice containing the detection row, column, it's center and the detection score (in case this is greater than 0.0). Source Edit
proc detect(fd: FaceDetector; image: Image8; findLandmarks: bool = true; minSize: int = 20; maxSize: int = 1000; minLandmarksScale: float32 = 50; shiftFactor: float32 = 0.1; scaleFactor: float32 = 1.1; perturbs: int = 63; angle: float32 = 0.0; overlapThreshold: float32 = overlapThresholdFloor; qualityThreshold: proc ( scale: float32): float32 = qualityThresholdFunc): seq[Person] {. ...raises: [ValueError, KeyError], tags: [].}
- Detects faces on images, then detects eyes and other landmarks. Source Edit
proc detect(lc: LandmarkCascade; image: Image8; x, y, scale: float32; perturbs: int; angle: float64 = 0.0; flipV: bool = false): Landmark {. ...raises: [], tags: [].}
- Runs the pupil/landmark localization function. Source Edit
proc detect(lc: LandmarkCascade; leftEye, rightEye: Landmark; image: Image8; perturbs: int; flipV: bool): Landmark {....raises: [], tags: [].}
- Retrieves the facial landmark point based on the pupil localization results. Source Edit
proc grayscale(image: pixie.Image): Image8 {....raises: [], tags: [].}
- Convert pixie's image to grayscale, so it can be processed by facedetect Source Edit
proc initFaceDetector(): FaceDetector {....raises: [IOError, OSError], tags: [ReadIOEffect, ReadDirEffect].}
- Loads face, eyes and landmark detection cascades Source Edit
proc qualityThresholdFunc(scale: float32): float32 {....raises: [], tags: [].}
- Returns the scale adjusted quality score threshold. Source Edit
proc readFaceCascade(filename: string = "cascade/facefinder"): FaceCascade {. ...raises: [IOError, OSError], tags: [ReadIOEffect].}
- Unpack the binary face classification file. Source Edit
proc readFaceCascade(fs: FileStream): FaceCascade {....raises: [IOError, OSError], tags: [ReadIOEffect].}
- Unpack the binary face classification file. Source Edit
proc readGrayscaleImage(filePath: string): Image8 {....raises: [PixieError], tags: [RootEffect, ReadIOEffect, WriteIOEffect].}
- Load image from the specified path and convert it to grayscale. Source Edit
proc readLandmarkCascade(filename: string = "cascade/puploc"): LandmarkCascade {. ...raises: [IOError, OSError], tags: [ReadIOEffect].}
- Unpacks the pupil localization cascade file Source Edit
proc readLandmarkCascade(fs: FileStream): LandmarkCascade {. ...raises: [IOError, OSError], tags: [ReadIOEffect].}
- Unpacks the pupil localization cascade file Source Edit
proc readLandmarkCascadeDir(dir: string = "cascade/lps"): Table[string, LandmarkCascade] {....raises: [OSError, IOError], tags: [ReadDirEffect, ReadIOEffect].}
- Reads the facial landmark points cascade files from the provided directory. Source Edit