Challenge

FINAL INDEPENDENT PROJECT

FACE DETECTOR

MATLAB IN FACE RECOGNITION:

IT is possible to achieve face recognition using matlab code . the built in class and function in matlab can be used to detect the face . the object vision.cascadeobjectdector system of the computer vision system toolbox recognizes object based on the viola jones face detection algorithem

DESCRIPTION OF THE MATLAB OBJECT DETECTOR:

The vision.cascadeobjectdetector makes use of the viola jones algorithm for the identification of face or the upper body . a custom classifier can be trained by using matlab image labeler and used along with the system object.so how are facial features or the upper body detected in an image

  1. The first step of the creation of the vision.cascadeobjectdetector object and sitting its properties
  2. In this step the object is invoked with argument

SYNTAX FOR THE CREATION OF THE OBJECT DETECTOR :

The syntax used for the creation of the object detector is as follows:

  1. Detector= vision.cascadeobjectdetector
  2. Detector= vision.cascade objectdetector(mode1)
  3. Detector = vision.cascadeobjectdetector(name,\)
  4. Detector = vision.cascadeobjectdetector(xmlfil)

DESCRIPTION OF THE SYNTAX:

vision.cascadeobjectdetector: this syntax is used for the creation of a detector that detects objects using the violajones algorithm

detector:

vision.cascadeobjectdetector(mode1) this syntax is used for the creation of adetector that is configured for detecting objects defining by the name input vector mode1

detector:

this syntax is used for setting properties by using one or moer than one name value paris whare each property name is enclosed within quotes

PROPERITIES;

Unless otherwise specified the features of the cascade objects detector are non tunable meaning that after calling the object their values cannot be altered . object get locked when they are invoked and their unlicking is dine by the released function

On the other hand a tunable property would mean thet its value can be changed at any time so let us have a look at some of the features before we understand face recognition using matlab codes

Classification model:

Defined as a character vector this property is responsible for controlling the type of object the default configuration of the detector detects face

MINSIZE:

The size of the smallest recognizable object is denoted as a tow elements vector unless a property value is specified the detector sets it to the image size used for training the classification model

Maxsize:

The size of the smallest recognizable object is denoted as a two element vector unless a property value is specified the detector sets it to size

SCALEFACTOR:

It has a specified value higher than 1.0001. this property is for incremental scalling of the detection resolution between minsize and maxsize

MERGETHRESHOLD:

It has a specified integer value equal to 4 in case there are multipule detections around a target object the threshold around a target object the threshold defines the final detection criteria

USEROL:

Specified as false this property can be set to true for the detection of objects within a rectangular region of interest in the input image

Syntax for using the object detector

  1. Bbox=detector(I)
  2. Bbox=detector(I,roi)

INPUT ARGUMENTS:

I-input image : it is specified as true color or grayscale

Model-classification model: it is specified as a character vector and describes the object typr to be detected

XMLFILE-custom classification model: specified as an xml file ,it can be created using opencv training functionally or the teaincascadeobjectdetector function

Roi-rectangular region of interest: a four element vector is used to specify this input argument

OUTOUT ARGUMENTS:

Bbox-detections: detection are returned as an m-by-4 element matrix each row of wich contains the four element vector

Step: for running system object algorithm

Release:fro releasing system resources

Reset: for resetting the internal states of system object.

Matlab code:

%face detection

clear all

clc

%detect object using viola-jones algorithm

%to detect face

Fdetect= vision.cascadeobjectdetector;

%read the input image

I= imred('harrypotter.jpg');

%returns bonding box values based on number of objects

BB = step(Fdetect,I);

figure,

imshow(I); hold on

for i = 1:size (BB,1)

rectangle('position',BB(i,:),'linewidth',5,'linestyle','-','edgecolor','r');

end

titile('face detection');

hold off;

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.