dumitru-daniel.popa

How to Detect Faces with NXP Vision Toolbox

Discussion created by dumitru-daniel.popa Employee on Jun 20, 2018

Face Detection

The following livescript uses MATLAB functionalities to simulate the face detection application. Face detection algorithm is implemented using Local Binary Patterns and Cascading Classifiers.
Read the input image.
inImgPath = 'data/face_detection.png';
inImgUMat = nxpvt.imread(inImgPath);
if isempty(inImgUMat)
    fprintf('Failed to open input image: %s.', inImgPath);
    return;
end
nxpvt.imshow(inImgUMat);
Define a face detector object.
width = uint32(640);
height = uint32(480);
fdetector = nxpvt.FaceDetector(width, height);
Apply the face detection algorithm on the grayscale image.
[bbox, l] = fdetector.GetFaces(inImgUMat);
Add the result on the original image.
outImgUMat = nxpvt.cv.rectangle(inImgUMat, bbox, [255, 0 ,0], 5);
nxpvt.imshow(outImgUMat);

Outcomes