TIEVisionFaceDetector
Declaration
TIEVisionFaceDetector = interface(TIEVisionBase)
Description
Finds faces using the YuNet neural network (OpenCV
FaceDetectorYN).
Compared with Haar cascades (
TIEVisionObjectsFinder), it finds tilted, partly turned and small faces more reliably, gives fewer false detections, and returns a score and five facial landmarks for each face (
TIEVisionDetectedFace).
The model is built into the IEVision DLL, so no extra files are needed.
Faces from about 10 pixels wide up to the full image are found. Large images are scaled down to
setMaxSize pixels for speed.
Faces tilted up to about 60 degrees are found, and their landmarks are
corrected for the tilt. Enable
setDetectRotated to also find sideways and upside down faces.
Use
alignFace to get upright, uniformly cropped faces, for example to train and query
TIEVisionFaceRecognizer.
Shortcut methods are available to
straighten a photo by the eyes,
crop to the main face and
obscure faces.
24 bit RGB, 32 bit RGBA, 8 bit gray scale and 1 bit images are supported.
Note: The YuNet model is licensed under the MIT license (Copyright © 2020 Shiqi Yu). See
OpenCV Zoo.
Demos
| Demos\IEVision\GetFaces\GetFaces.dpr |
| Demos\ImageEditing\EveryMethod\EveryMethod.dpr |
Example
var
detector: TIEVisionFaceDetector;
faces: TIEVisionVectorObjRef;
face: TIEVisionDetectedFace;
r: TIEVisionRect;
i: Integer;
begin
detector := IEVisionLib.createFaceDetector();
faces := detector.detect( ImageEnView1.IEBitmap.GetIEVisionImage(), IEVisionRect( 0, 0, 0, 0 ));
for i := 0 to faces.size() - 1 do
begin
face := TIEVisionDetectedFace( faces.getObj( i ));
r := face.getRect();
ImageEnView1.LayersAdd( iesRectangle, Rect( r.x, r.y, r.x + r.width, r.y + r.height ), clRed, 2 );
end;
end;
Methods and Properties
See Also
◼createFaceDetector
◼TIEVisionDetectedFace
◼TIEVisionObjectsFinder
◼TIEVisionFaceRecognizer
◼DetectFaces
◼LevelByEyes
◼CropToFace
◼BlurFaces
◼detect