0% found this document useful (0 votes)
122 views9 pages

Face Recognition Using Matlab

This document summarizes a real-time face detection program developed using MATLAB. [1] It uses the Viola-Jones algorithm to detect faces, eyes, and upper bodies in images or video. [2] The program works by creating a detector object, taking an input image, detecting features, and annotating the detections. [3] To test the program, the user installs MATLAB, checks their camera device ID, runs the program GUI to start detection and view the results.

Uploaded by

Bolla Mahesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views9 pages

Face Recognition Using Matlab

This document summarizes a real-time face detection program developed using MATLAB. [1] It uses the Viola-Jones algorithm to detect faces, eyes, and upper bodies in images or video. [2] The program works by creating a detector object, taking an input image, detecting features, and annotating the detections. [3] To test the program, the user installs MATLAB, checks their camera device ID, runs the program GUI to start detection and view the results.

Uploaded by

Bolla Mahesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

FACE RECOGNITION USING MATLAB

Real-Time Face Detection Using MATLAB


Object detection and tracking are important in many computer vision
applications, including activity recognition, automotive safety and surveillance.
Presented here is an face detection using MATLAB system that can detect not
only a human face but also eyes and upper body.

Face detection is an easy and simple task for humans, but not so for computers. It
has been regarded as the most complex and challenging problem in the field of
computer vision due to large intra-class variations caused by the changes in facial
appearance, lighting and expression. Such variations result in the face distribution
to be highly nonlinear and complex in any space that is linear to the original
image space.

Face detection is the process of identifying one or more human faces in images or
videos. It plays an important part in many biometric, security and surveillance
systems, as well as image and video indexing systems.

This face detection using MATLAB program can be used to detect a


face, eyes and upper body on pressing the corresponding buttons. The
program output screen is shown in Fig. 1.
Fig. 1: Program output screen

Software program
This real-time face detection program is developed using MATLAB
version R2012a. A graphic user interface (GUI) allows users to perform
tasks interactively through controls like switches and sliders. You can
easily create a GUI and run it in MATLAB or as a stand-alone
application. The initial program output of this project is shown in Fig. 1.

Viola-Jones algorithm. There are different types of algorithms used in


face detection. Here, we have used Viola-Jones algorithm for face
detection using MATLAB program. This algorithm works in following
steps:
1.Creates a detector object using  Viola-Jones algorithm
2.Takes the image from the video
3.Detectsfeatures
4. Annotates the deteted features

MATLAB functions

The program (testing.m) has many functions. Do not edit the functions
as these are linkers and non-executable codes. First, you have to find
the format supported by the camera and its device ID using the
command given below (also shown in Fig. 2):

Fig. 2: Checking the device ID

imaqhwinfo(‘winvideo’)

After finding the device ID, you can change the device ID number in
your source code.
The device ID here is {1}, so we have written ‘1’ in the code, as
mentioned below:

vid=videoinput(‘winvideo’,1,’YUY2_
640×480’);

We also have other formats in MATLAB. You can check which format
your camera supports by using the commands below (also shown in
Fig. 3):
info.DeviceInfo (1)
info.DeviceInfo.SupportedFormats

In Fig. 3, you can see that format ‘YUY2_160x120’ is the one supported
by the camera by default. But, there are other formats (resolutions)
that your camera can support, as shown in the last line of this
screenshot. If you select a different format and device number, you
should make changes in the source code accordingly. To detect a face
or a particular feature on the faces of people, use the following steps in
MATLAB program (testing.m):

1. Define and set-up your cascade object detector using the


constructor:

detector=vision.CascadeObjectDetector

It creates a system object detector that detects objects using Viola-


Jones algorithm. Its classification model property controls the type of
object to detect. By default, the detector is configured to detect faces .
Fig. 4: Face detection

Fig. 5: Eyes detection


Fig. 6: Upper body detection

2. Call the step method with input image I, cascade object detector,
points PTS and any other optional properties.

Below is the syntax for using the step method. Use the step syntax with
input image I, selected cascade object detector and other optional
properties to perform detection.

BBOX = step (detector, I)

It returns BBOX, an M-by-4 matrix defining M-bounding boxes,


containing detected objects. This method performs multi-scale object
detection on input image I. Each row of output matrix BBOX contains a
four-element vector (x, y, width and height) that specifies in pixels, the
upper-left corner and size of a bounding box. Input image I must be a
gray scale or true colour (RGB) image.

3. The third step is:

insertObjectAnnotation(I,’rectangle’,
Position,Label)

It inserts rectangles and corresponding labels at the location indicated


by the position matrix. The position input must be an M-by-4 matrix,
where each row (M) specifies a rectangle as a four-element vector (x, y,
width and height). Elements x and y indicate the upper-left corner of
the rectangle, and the width and height specify the size .

Face detection using MATLAB system testing


To test this program, follow the steps given below:

1. Install MATLAB version R2012a or higher version in your


system. Launch it from desktop shortcut. You will see a blank
command window.
2. Download the source folder.
3. Check the device ID, as shown in Fig. 2, and write the device ID
number in the source code.
4. Run the program. A GUI will appear, as shown in Fig. 1.
5. Click on Start button to initialise camera settings.
6. Next, click on Face button and the camera will detect the face.
Your face will be detected and displayed on the right side of the
screen (Fig. 4). Similarly, you can also detect your eyes and
upper body by clicking on the respective buttons. The output
screenshots for the detected eyes and upper body are shown in
Fig. 5 and Fig. 6, respectively. Remember to click Stop button
first to stop the previous process in order to detect other two
features.
7. To stop, click Stop button.

BY

j.Shekin paul 180040597s

G.VIVEK 180040388

You might also like