I am a newbie in image processing projects and currently I am focusing on MATLAB based face detection, recognition and tracking. Here, I will write about my projects.

Face Detection using MATLAB

A simple MATLAB script can detect faces successfully from an image file. Here we will detect the faces and mark the detected faces in a box. We have to keep the image and the MATLAB program file in the same folder.

The steps are given below.

Step 1: Read the image using imread function
Image = imread(‘friends.jpg’);

Step 2: Implement an algorithm which will detect the faces out of an image
detectFace = vision.CascadeObjectDetector();

Step 3: Use the algorithm on our image file and get the geometric details of the image (Number of faces, Coordinates and Size)
Box = step(detectFace, Image);

Step 4: Mark the faces on the image
B = insertObjectAnnotation(Image, ‘rectangle’, Box, ‘Face’);
imshow(B), title(‘Detected Faces’);

Step 5: Display the number of faces in a string
n = size(Box,1);
str_n = num2str(n);
str = strcat(‘Number of detected faces are = ‘, str_n);