1
A
PROJECT REPORT
on
FACE DETECTION AND TRACKING
Submitted in partial fulfilment of the requirements for the degree of
BACHELOR OF TECHNOLOGY
Batch: - 2014-18
Submitted by
Narayan Lal Menariya (14ETCEC015)
Varun Bhatnagar (14ETCEC030)
8Th Semester, ECE
Under Guidance of
Isha Purbia
Assistant Professor
ECE, Techno India NJR
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR-313003
2
TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR
ELECTRONICS & COMMUNICATION ENGINEERING
DEPARTMENT
CERTIFICATE
This is to certify that the Project Report titled 8Th Semester Project was prepared and presented by
NARAYAN LAL MENARIYA of Techno India NJR Institute of Technology, Udaipur in partial
fulfillment of the requirement as a subject under the Rajasthan Technical University during the B.Tech
Final Year VIIIth Semester.
Dr. Vivek Jain Assistant Prof. Nitin Kothari
( Guide ) (Head Of Department)
3
Preface
Digital image processing is the use of computer algorithms to perform image processing on digital
images. As a subcategory or field of digital signal processing, digital image processing has many
advantages over analog image processing. It allows a much wider range of algorithms to be applied to
the input data and can avoid problems such as the build-up of noise and signal distortion during
processing. Since images are defined over two dimensions (perhaps more) digital image processing
may be modeled in the form of multidimensional systems.
In Chapter 1, Introduction to Matlab, Basics of Matlab and Understanding of Digital signal processing
Chapter 2 Face detection and Tracking , Concept of room automation using face detection.
Understanding and practically verified video processing
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR-313003
4
ACKNOWLEDGMENTS
We take this opportunity to record our sincere thanks to all who helped us to successfully complete this
work. Firstly, We are grateful to our Assistant Prof. Isha Purbia for his invaluable guidance and
constant encouragement, support and most importantly for giving us the opportunity to carry out this
work.
We would like to express our deepest sense of gratitude and humble regards to our
Head of Department Assistant Prof. Nitin Kothari for giving invariable encouragement in our
endeavors and providing necessary facility for the same. We are very thankful to Prof. Pradeep
Chhawchharia , Director (Research & New Initiatives) for encouraging us in this project work. Also
a sincere thanks to all faculty members of ECE, TINJRIT for their help in the project directly or
indirectly.
Finally, We would like to thank my friends for their support and discussions that have proved very
valuable for us. We are indebted to our parents for providing constant support, love and
encouragement. We thank them for the sacrifices they made so that we could grow up in a learning
environment. They have always stood by us in everything we have done, providing constant support,
encouragement and love
NARAYAN LAL MENARIYA (14ETCEC015)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR-313003
5
CONTENTS
CATEGORY PAGE NO.
List of Tables……………………………………………………...................................
5
List of Figure…………………………………………………………………………… 6
Chapter 1 INTRODUCTION…………………………………………...................... 7
8
8
9
10
10
11
16
17
17
Chapter 2 MATLAB IMAGE PROCESSING TOOLBOX
2.1 Typical usage
2.2 The basic
2.3 Application of MATLAB
2.4 Video Processing Toolbox
2.5 Room Automation Using Face Detection And MATLAB DIP
2.6 Results
2.7 Limitation
2.8 Conclusion
Appendix……………………………………………………………………………….. 19
Reference……………………………………………………………………………….. 23
6
List of Tables
Sr. no. Title Page No.
1.1 Matlab Image Processing Toolbox 7
7
Fig.No. List of Figures PAGE NO.
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
2.10
MATLAB logo
MATLAB window
Face recognition
Hue image
Tracked image
Haar field image
Quadrant divided image
Camera image of room
Quadrant divided image
Face detected in quadrant
8
9
12
13
13
15
15
16
17
17
8
CHAPTER 1
INTRODUCTION
1.1 Module 1:
Matlab Image Processing
Table 1.1: Matlab
Topics Covered
 Matlab Basic Concepts
 Matalab Image Processing Toolbox
9
Chapter 2
Matlab Image Processing Toolbox
Fig 2.1 Matlab logo
MATLAB, short for Matrix Laboratory is a programming package specifically designed for quick and
easy scientific calculations and I/O. It has literally hundreds of built-in functions for a wide variety of
computations and many toolboxes designed for specific research disciplines, including statistics,
optimization, solution of partial differential equations, data analysis. MATLAB is an high performance
language for technical computing. It integrates computation, visualization and programming in an easy
to use environment where problems and solutions are expressed in familiar mathematical notations .
2.1 Typical uses include:
 Math and computation
 Algorithm development modeling ,simulation and prototyping Data analysis, exploration and
visualization
 Scientific and engineering computations
MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This allows you to solve many technical computing problems, especially those with
matrix and vector formulation, in a fraction of the time it would take to write a program in a scalar non
interactive language such as C or Fortran.
10
MATLAB has evolved over a period of years with input from many users. In university environments,
it is the standard instructional tool for introductory and advanced courses in mathematics, engineering
and science. In industry, MATLAB is the tool of choice for high productivity research, development
and analysis.
MATLAB features a family of application specific solutions called toolboxes. Very important to most
users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are
comprehensive collections of MATLAB functions that extend the MATLAB environment to solve
particular classes of problems. Areas in which toolboxes are available include signal processing,
control systems, neural networks, fuzzy logic, simulation and many more.
2.2 THE BASIC
The MATLAB window should come up on your screen. It looks like:
Fig. 2.2 Matlab window
11
This is the window in which you interact with MATLAB. The main window on the right is called the
Command Window. You can see the command prompt in this window, which looks like >>. If this
prompt is visible MATLAB is ready for you to enter a command. In the top left corner you can view
the Launch Pad window and the Workspace window. Swap from one to the other by clicking on the
appropriate tag. The Workspace window will show you all variables that you are using in your current
MATLAB session. When you first start up MATLAB, the workspace is empty. In the bottom left
corner you can see the Command History window, which simply gives a chronological list of all
MATLAB commands that you used, and the Current Directory window which shows you the contents
and location of the directory you are currently working in.
2.3APPLICATIONS OF MATLAB
 In Aerospace and defence
 IT and programming field
 Graphic design and multimedia
 Finances and accounting
 Sales and marketing
2.4 VIDEO PROCESSING TOOLBOX
Digital image processing is the use of computer algorithms to perform image processing on digital
images. As a subcategory or field of digital signal processing, digital image processing has many
advantages over analog image processing. It allows a much wider range of algorithms to be applied
to the input data and can avoid problems such as the build-up of noise and signal distortion during
processing. Since images are defined over two dimensions (perhaps more) digital image processing
may be modeled in the form of multidimensional systems.
An image sensor or imaging sensor is a sensor that detects and conveys the information that
constitutes an image. It does so by converting the variable attenuation of light waves (as they pass
through or reflect off objects) into signals, small bursts of current that convey the information. The
waves can be light or other electromagnetic radiation. Image sensors are used in electronic imaging
devices of both analog and digital types, which include digital cameras, camera modules, medical
imaging equipment, night vision equipment such as thermal imaging devices, radar, sonar, and
others. As technology changes, digital imaging tends to replace analog imaging.
12
Early analog sensors for visible light were video camera tubes. Currently, used types
are semiconductor charge-coupled devices (CCD) or active pixel sensors in complementary metal–
oxide–semiconductor (CMOS) or N-type metal-oxide-semiconductor (NMOS, Live MOS)
technologies. Analog sensors for invisible radiation tend to involve vacuum tubes of various kinds.
Digital sensors include flat panel detectors.
2.5 ROOM AUTOMATION USING FACE DETECTIONMATLAB IMAGE
PROCESSINGTOOLBOX
 PROCEDURE
 Detecting Face
Introduction
Object detection and tracking are important in many computer vision applications including activity
recognition, automotive safety, and surveillance. In this example, you will develop a simple face
tracking system by dividing the tracking problem into three separate problems:
1. Detect a face to track
2. Identify facial features to track
3. Track the face
Step 1: Detect a Face To Track
Before you begin tracking a face, you need to first detect it. Use the vision.CascadeObjectDetector to
detect the location of a face in a video frame. The cascade object detector uses the Viola-Jones
detection algorithm and a trained classification model for detection. By default, the detector is
configured to detect faces, but it can be configured for other
13
Fig. 2.3 Face recognition
You can use the cascade object detector to track a face across successive video frames. However, when
the face tilts or the person turns their head, you may lose tracking. This limitation is due to the type of
trained classification model used for detection. To avoid this issue, and because performing face
detection for every video frame is computationally intensive, this example uses a simple facial feature
for tracking.
Step 2: Identify Facial Features To Track
Once the face is located in the video, the next step is to identify a feature that will help you track the
face. For example, you can use the shape, texture, or color. Choose a feature that is unique to the object
and remains invariant even when the object moves.
In this example, you use skin tone as the feature to track. The skin tone provides a good deal of contrast
between the face and the background and does not change as the face rotates or moves.
14
Fig. 2.4 Hue image
Step 3: Track the Face
With the skin tone selected as the feature to track, you can now use
the vision.HistogramBasedTracker for tracking. The histogram based tracker uses the CAMShift
algorithm, which provides the capability to track an object using a histogram of pixel values. In this
example, the Hue channel pixels are extracted from the nose region of the detected face. These pixels
are used to initialize the histogram for the tracker. The example tracks the object over successive video
frames using this histogram.
Fig. 2.5 Tracked image
15
 CAMShift Algorithm:
1. Set the region of interest (ROI) of the probability distribution image to the entire image.
2. Select an initial location of the Mean Shift search window. The selected location is the target
distribution to be tracked.
3. Calculate a colour probability distribution of the region centred at the Mean Shift search
window.
4. Iterate Mean Shift algorithm to find the centroid of the probability image. Store the zeroth
moment (distribution area) and centroid location.
5. For the following frame, centre the search window at the mean location found in Step 4 and set
the window size to a function of the zeroth moment. Go to Step 3.
 Viola-Jones algorithm: Two features are selected for the task of face detection:
1. first feature: the region of the eyes is often darker than the region of the nose and cheeks
2. second feature: the eyes are darker than the bridge of the nose
3. Classifier can be constructed which reject many of the negative sub windows while detecting
almost all positive instances.
4. The final detector is scanned across the image at multiple scales and locations
5. The detector is also scanned across location, by shifting the window some number of pixels
6. It is useful to post process the detected sub-windows in order to combine overlapping detections
into a single detection
16
Fig. 2.6 Haar image
 Detecting Respective Quadrant Of Class Room In Which Face Is
Detected :
 as shown in figure we can see that face is detected in each quadrant 1-2.
 So in quadrant 2 face is detected
Fig. 2.7 Quadrant divided image
17
2.6 RESULT
 Camera Image
Fig. 2.8 Camera image of room
 Image SeparatedIn Quadrant
Fig. 2.9 Quadrant divided image
18
 Face DetectedIn Each & Every Quadrant
Fig.2.10 Face detected in quadrant 2
2.7 LIMITATIONS
 Multiple Face Tracking is Yet to implement
 4 quadrant detection is yet to implement
 Quadrants dimension are user defined not automatic
 Photo Frames in room can reduce applicability of the program
 Intially to start the process 1st frame with face detected is required
2.8 CONCLUSION
The main concernof this project is to save the wastage of unwanted electricity.
Although this can be done using various other methods but this project is proposed to
control the home appliance automatically using MATLAB.
This project is of low costand can be applicable to various places such as
 Domestic application
 Industrial application
19
 Medical application
 Military application
The main advantages of this project is that the area used for installation of this project is
very less and also it requires very less maintenance.
20
APPENDIX
ProgramCode:
clc,clear all,close all
bodyDetector = vision.CascadeObjectDetector('UpperBody');
bodyDetector.MinSize = [20 22];
bodyDetector.MergeThreshold =10 ;
videoFileReader = vision.VideoFileReader('classroom1.mp4');
videoFrame = step(videoFileReader);
figure;imshow(videoFrame)
videoFrame = step(videoFileReader);
figure;imshow(videoFrame)
%display image in 4 frames
I1=videoFrame(1:240,1:160);
I2=videoFrame(1:240,160:320);
figure;
subplot(1,2,1),imshow(I1);
subplot(1,2,2),imshow(I2);
% subplot(2,2,3),imshow(I3);
% subplot(2,2,4),imshow(I4);
21
bbox1 = step(bodyDetector, I1);
bbox2 = step(bodyDetector, I2);
% Draw the returned bounding box around the detected face.
videoOut = insertObjectAnnotation(I1,'rectangle',bbox1,'face');
figure, imshow(videoOut), title('Detected body');
videoOut = insertObjectAnnotation(I2,'rectangle',bbox2,'face');
figure, imshow(videoOut), title('Detected body');
videoInfo = info(videoFileReader);
videoPlayer = vision.VideoPlayer('Position',[300 300 videoInfo.VideoSize+30]);
flag1=0;
flag2=0;
while ~isDone(videoFileReader)
% Extract the next video frame
videoFrame = step(videoFileReader);
I1=videoFrame(1:240,1:160);
I2=videoFrame(1:240,160:320);
bbox1 = step(bodyDetector, I1);
bbox2 = step(bodyDetector, I2);
% isempty return 0 if array have some values
22
f1=isempty(bbox1);
f2 =isempty(bbox2);
if f2==0
flag2=1
else
flag2=0
end
if f1==0
flag1=1
else
flag1=0
end
videoOut = insertObjectAnnotation(I1,'rectangle',bbox1,'face');
figure, imshow(videoOut), title('Detected body');
videoOut = insertObjectAnnotation(I2,'rectangle',bbox2,'face');
figure, imshow(videoOut), title('Detected body');
% Display the annotated video frame using the video player object
step(videoPlayer, videoOut);
23
end
Release resources
release(videoFileReader);
release(videoPlayer);
24
REFERENCES
 Description book provided by Cranes Software International, Bangalore.
 Matlab Image toolbox (Matlab 2017a)
 Electricity Sector in India – Wikipedia
 (https://en.wikipedia.org/wiki/Electricity_sector_in_India )
 Image source – Google
 MATLAB Help menu
 Youtube – Matlab Image Processing
 MATALB Reference note by Cranes Varsity

More Related Content

PPTX
face detection
PPTX
Face Detection Using MATLAB (SUD)
PPTX
human face detection using matlab
PDF
Image–based face-detection-and-recognition-using-matlab
PPT
Face Detection techniques
PPTX
Project Face Detection
PPTX
Face recognition technology
PPTX
Detection and recognition of face using neural network
face detection
Face Detection Using MATLAB (SUD)
human face detection using matlab
Image–based face-detection-and-recognition-using-matlab
Face Detection techniques
Project Face Detection
Face recognition technology
Detection and recognition of face using neural network

What's hot (20)

PPTX
Image attendance system
PPTX
FACE RECOGNITION USING NEURAL NETWORK
PPTX
Face recognization using artificial nerual network
DOCX
Emotion recognition from facial expression using fuzzy logic
PDF
Face Recognition Methods based on Convolutional Neural Networks
PPTX
Automated attendance system based on facial recognition
PPTX
Face Detection
PDF
Real time multi face detection using deep learning
DOCX
MAJOR PROJECT
PPTX
HUMAN FACE IDENTIFICATION
PDF
IRJET- Automated Detection of Gender from Face Images
PPTX
Face and Eye Detection Varying Scenarios With Haar Classifier_2015
PPTX
Face detection and recognition using surveillance camera2 edited
PPTX
Face detection and recognition
PDF
Report face recognition : ArganRecogn
PDF
Facial expression recognition
PPT
Week6 face detection
PPTX
Model Based Emotion Detection using Point Clouds
PPTX
Facel expression recognition
Image attendance system
FACE RECOGNITION USING NEURAL NETWORK
Face recognization using artificial nerual network
Emotion recognition from facial expression using fuzzy logic
Face Recognition Methods based on Convolutional Neural Networks
Automated attendance system based on facial recognition
Face Detection
Real time multi face detection using deep learning
MAJOR PROJECT
HUMAN FACE IDENTIFICATION
IRJET- Automated Detection of Gender from Face Images
Face and Eye Detection Varying Scenarios With Haar Classifier_2015
Face detection and recognition using surveillance camera2 edited
Face detection and recognition
Report face recognition : ArganRecogn
Facial expression recognition
Week6 face detection
Model Based Emotion Detection using Point Clouds
Facel expression recognition
Ad

Similar to Face Detection And Tracking (20)

PDF
A review on image processing
PPTX
Matlab for Electrical Engineers
PPTX
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DOCX
Autonomous robot
PPTX
image processing using matlab in faculty 2
PDF
cseimageprocessingppt-170902095009.pdf
PPT
ANPR based Security System Using ALR
PPTX
Matlab demo
PPTX
Image Processing By SAIKIRAN PANJALA
PDF
(eBook PDF) Hands-On Introduction to LabVIEW for Scientists and Engineers 4th...
PDF
2015 2016 ieee matlab project titles
PPTX
Image proccessing slide share
PPTX
IEEE Papers on Image Processing
PPSX
Summer training introduction to matlab
PPT
mathematics laboratory lecture 1_matlab.ppt
PPTX
PPTX
Summer training matlab
PPTX
Introductory Digital Image Processing using Matlab, IIT Roorkee
A review on image processing
Matlab for Electrical Engineers
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
Autonomous robot
image processing using matlab in faculty 2
cseimageprocessingppt-170902095009.pdf
ANPR based Security System Using ALR
Matlab demo
Image Processing By SAIKIRAN PANJALA
(eBook PDF) Hands-On Introduction to LabVIEW for Scientists and Engineers 4th...
2015 2016 ieee matlab project titles
Image proccessing slide share
IEEE Papers on Image Processing
Summer training introduction to matlab
mathematics laboratory lecture 1_matlab.ppt
Summer training matlab
Introductory Digital Image Processing using Matlab, IIT Roorkee
Ad

More from NarayanlalMenariya (17)

PDF
Latest Updated Resume Narayan Lal Menariya
PDF
Updated CV
PDF
Curriculum Vitae
PDF
Resume for fresher
PDF
C++ Programs
DOCX
Character recognition
DOCX
GUI based calculator using MATLAB
DOCX
Steganography
DOCX
client-server communication using socket IPC
DOCX
Message queue and shared memory
DOCX
Synchronization of shared memory using semaphores
PPTX
Home automation using MATLAB image processing
DOC
Simplified Experimental Determination of Line Transient Immunity of Linear Re...
PDF
SMART E-TOLL SYSTEM
DOCX
Voice From Deep Of Heart
PPTX
Lidar and sensing
PDF
A chip to protect IOT
Latest Updated Resume Narayan Lal Menariya
Updated CV
Curriculum Vitae
Resume for fresher
C++ Programs
Character recognition
GUI based calculator using MATLAB
Steganography
client-server communication using socket IPC
Message queue and shared memory
Synchronization of shared memory using semaphores
Home automation using MATLAB image processing
Simplified Experimental Determination of Line Transient Immunity of Linear Re...
SMART E-TOLL SYSTEM
Voice From Deep Of Heart
Lidar and sensing
A chip to protect IOT

Recently uploaded (20)

PPTX
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
PDF
D6E Engine Volvo EC160C NL Excavator Service Repair Manual.pdf
PDF
Audi A3 20 TFSi Timing Belt Installation
PDF
John Deere 410E II Articulated Dump Truck Service Manual.pdf
PDF
BOBCAT 442 Excavator Service Repair Manual.pdf
PDF
Dongguan Sunnew ESS Profile for the year of 2023
PPTX
Found naturally in fruits, vegetables, n
PPTX
PHILOSOPHY lesson for my presentation tomorrow
PDF
Smart_Doors_Trunk_Control_Presentation.pdf
PPTX
Electric Vehicles vs Combustion Engine Vehicles.pptx
PDF
Transmission John Deere 370E 410E 460E Technical Manual.pdf
PPTX
Total quality management and I have a great day
PPT
IOT UNIT –II-IT ppt (1).pptsssssddfdfdffdfd
PDF
Designyze – Creative Digital Marketing & Design Agency in India
PPTX
APQP FOR AUTOMOTIVE AND PPAP FOR SUPPLIER
PDF
System Diagrams John Deere 370E 410E 460E Repair Manual.pdf
PPTX
DNA Packaging in Eukaryot ic Cells.pptx
PPTX
Victory precisions_Die casting foundry_.pptx
PDF
TM1611 John Deere 410E service Repair Manual.pdf
PDF
Where to Buy Verified LinkedIn Accounts Securely in 2025.pdf
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
D6E Engine Volvo EC160C NL Excavator Service Repair Manual.pdf
Audi A3 20 TFSi Timing Belt Installation
John Deere 410E II Articulated Dump Truck Service Manual.pdf
BOBCAT 442 Excavator Service Repair Manual.pdf
Dongguan Sunnew ESS Profile for the year of 2023
Found naturally in fruits, vegetables, n
PHILOSOPHY lesson for my presentation tomorrow
Smart_Doors_Trunk_Control_Presentation.pdf
Electric Vehicles vs Combustion Engine Vehicles.pptx
Transmission John Deere 370E 410E 460E Technical Manual.pdf
Total quality management and I have a great day
IOT UNIT –II-IT ppt (1).pptsssssddfdfdffdfd
Designyze – Creative Digital Marketing & Design Agency in India
APQP FOR AUTOMOTIVE AND PPAP FOR SUPPLIER
System Diagrams John Deere 370E 410E 460E Repair Manual.pdf
DNA Packaging in Eukaryot ic Cells.pptx
Victory precisions_Die casting foundry_.pptx
TM1611 John Deere 410E service Repair Manual.pdf
Where to Buy Verified LinkedIn Accounts Securely in 2025.pdf

Face Detection And Tracking

  • 1. 1 A PROJECT REPORT on FACE DETECTION AND TRACKING Submitted in partial fulfilment of the requirements for the degree of BACHELOR OF TECHNOLOGY Batch: - 2014-18 Submitted by Narayan Lal Menariya (14ETCEC015) Varun Bhatnagar (14ETCEC030) 8Th Semester, ECE Under Guidance of Isha Purbia Assistant Professor ECE, Techno India NJR DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR-313003
  • 2. 2 TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR ELECTRONICS & COMMUNICATION ENGINEERING DEPARTMENT CERTIFICATE This is to certify that the Project Report titled 8Th Semester Project was prepared and presented by NARAYAN LAL MENARIYA of Techno India NJR Institute of Technology, Udaipur in partial fulfillment of the requirement as a subject under the Rajasthan Technical University during the B.Tech Final Year VIIIth Semester. Dr. Vivek Jain Assistant Prof. Nitin Kothari ( Guide ) (Head Of Department)
  • 3. 3 Preface Digital image processing is the use of computer algorithms to perform image processing on digital images. As a subcategory or field of digital signal processing, digital image processing has many advantages over analog image processing. It allows a much wider range of algorithms to be applied to the input data and can avoid problems such as the build-up of noise and signal distortion during processing. Since images are defined over two dimensions (perhaps more) digital image processing may be modeled in the form of multidimensional systems. In Chapter 1, Introduction to Matlab, Basics of Matlab and Understanding of Digital signal processing Chapter 2 Face detection and Tracking , Concept of room automation using face detection. Understanding and practically verified video processing DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR-313003
  • 4. 4 ACKNOWLEDGMENTS We take this opportunity to record our sincere thanks to all who helped us to successfully complete this work. Firstly, We are grateful to our Assistant Prof. Isha Purbia for his invaluable guidance and constant encouragement, support and most importantly for giving us the opportunity to carry out this work. We would like to express our deepest sense of gratitude and humble regards to our Head of Department Assistant Prof. Nitin Kothari for giving invariable encouragement in our endeavors and providing necessary facility for the same. We are very thankful to Prof. Pradeep Chhawchharia , Director (Research & New Initiatives) for encouraging us in this project work. Also a sincere thanks to all faculty members of ECE, TINJRIT for their help in the project directly or indirectly. Finally, We would like to thank my friends for their support and discussions that have proved very valuable for us. We are indebted to our parents for providing constant support, love and encouragement. We thank them for the sacrifices they made so that we could grow up in a learning environment. They have always stood by us in everything we have done, providing constant support, encouragement and love NARAYAN LAL MENARIYA (14ETCEC015) DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING TECHNO INDIA NJR INSTITUTE OF TECHNOLOGY, UDAIPUR-313003
  • 5. 5 CONTENTS CATEGORY PAGE NO. List of Tables……………………………………………………................................... 5 List of Figure…………………………………………………………………………… 6 Chapter 1 INTRODUCTION…………………………………………...................... 7 8 8 9 10 10 11 16 17 17 Chapter 2 MATLAB IMAGE PROCESSING TOOLBOX 2.1 Typical usage 2.2 The basic 2.3 Application of MATLAB 2.4 Video Processing Toolbox 2.5 Room Automation Using Face Detection And MATLAB DIP 2.6 Results 2.7 Limitation 2.8 Conclusion Appendix……………………………………………………………………………….. 19 Reference……………………………………………………………………………….. 23
  • 6. 6 List of Tables Sr. no. Title Page No. 1.1 Matlab Image Processing Toolbox 7
  • 7. 7 Fig.No. List of Figures PAGE NO. 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 MATLAB logo MATLAB window Face recognition Hue image Tracked image Haar field image Quadrant divided image Camera image of room Quadrant divided image Face detected in quadrant 8 9 12 13 13 15 15 16 17 17
  • 8. 8 CHAPTER 1 INTRODUCTION 1.1 Module 1: Matlab Image Processing Table 1.1: Matlab Topics Covered  Matlab Basic Concepts  Matalab Image Processing Toolbox
  • 9. 9 Chapter 2 Matlab Image Processing Toolbox Fig 2.1 Matlab logo MATLAB, short for Matrix Laboratory is a programming package specifically designed for quick and easy scientific calculations and I/O. It has literally hundreds of built-in functions for a wide variety of computations and many toolboxes designed for specific research disciplines, including statistics, optimization, solution of partial differential equations, data analysis. MATLAB is an high performance language for technical computing. It integrates computation, visualization and programming in an easy to use environment where problems and solutions are expressed in familiar mathematical notations . 2.1 Typical uses include:  Math and computation  Algorithm development modeling ,simulation and prototyping Data analysis, exploration and visualization  Scientific and engineering computations MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulation, in a fraction of the time it would take to write a program in a scalar non interactive language such as C or Fortran.
  • 10. 10 MATLAB has evolved over a period of years with input from many users. In university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering and science. In industry, MATLAB is the tool of choice for high productivity research, development and analysis. MATLAB features a family of application specific solutions called toolboxes. Very important to most users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are comprehensive collections of MATLAB functions that extend the MATLAB environment to solve particular classes of problems. Areas in which toolboxes are available include signal processing, control systems, neural networks, fuzzy logic, simulation and many more. 2.2 THE BASIC The MATLAB window should come up on your screen. It looks like: Fig. 2.2 Matlab window
  • 11. 11 This is the window in which you interact with MATLAB. The main window on the right is called the Command Window. You can see the command prompt in this window, which looks like >>. If this prompt is visible MATLAB is ready for you to enter a command. In the top left corner you can view the Launch Pad window and the Workspace window. Swap from one to the other by clicking on the appropriate tag. The Workspace window will show you all variables that you are using in your current MATLAB session. When you first start up MATLAB, the workspace is empty. In the bottom left corner you can see the Command History window, which simply gives a chronological list of all MATLAB commands that you used, and the Current Directory window which shows you the contents and location of the directory you are currently working in. 2.3APPLICATIONS OF MATLAB  In Aerospace and defence  IT and programming field  Graphic design and multimedia  Finances and accounting  Sales and marketing 2.4 VIDEO PROCESSING TOOLBOX Digital image processing is the use of computer algorithms to perform image processing on digital images. As a subcategory or field of digital signal processing, digital image processing has many advantages over analog image processing. It allows a much wider range of algorithms to be applied to the input data and can avoid problems such as the build-up of noise and signal distortion during processing. Since images are defined over two dimensions (perhaps more) digital image processing may be modeled in the form of multidimensional systems. An image sensor or imaging sensor is a sensor that detects and conveys the information that constitutes an image. It does so by converting the variable attenuation of light waves (as they pass through or reflect off objects) into signals, small bursts of current that convey the information. The waves can be light or other electromagnetic radiation. Image sensors are used in electronic imaging devices of both analog and digital types, which include digital cameras, camera modules, medical imaging equipment, night vision equipment such as thermal imaging devices, radar, sonar, and others. As technology changes, digital imaging tends to replace analog imaging.
  • 12. 12 Early analog sensors for visible light were video camera tubes. Currently, used types are semiconductor charge-coupled devices (CCD) or active pixel sensors in complementary metal– oxide–semiconductor (CMOS) or N-type metal-oxide-semiconductor (NMOS, Live MOS) technologies. Analog sensors for invisible radiation tend to involve vacuum tubes of various kinds. Digital sensors include flat panel detectors. 2.5 ROOM AUTOMATION USING FACE DETECTIONMATLAB IMAGE PROCESSINGTOOLBOX  PROCEDURE  Detecting Face Introduction Object detection and tracking are important in many computer vision applications including activity recognition, automotive safety, and surveillance. In this example, you will develop a simple face tracking system by dividing the tracking problem into three separate problems: 1. Detect a face to track 2. Identify facial features to track 3. Track the face Step 1: Detect a Face To Track Before you begin tracking a face, you need to first detect it. Use the vision.CascadeObjectDetector to detect the location of a face in a video frame. The cascade object detector uses the Viola-Jones detection algorithm and a trained classification model for detection. By default, the detector is configured to detect faces, but it can be configured for other
  • 13. 13 Fig. 2.3 Face recognition You can use the cascade object detector to track a face across successive video frames. However, when the face tilts or the person turns their head, you may lose tracking. This limitation is due to the type of trained classification model used for detection. To avoid this issue, and because performing face detection for every video frame is computationally intensive, this example uses a simple facial feature for tracking. Step 2: Identify Facial Features To Track Once the face is located in the video, the next step is to identify a feature that will help you track the face. For example, you can use the shape, texture, or color. Choose a feature that is unique to the object and remains invariant even when the object moves. In this example, you use skin tone as the feature to track. The skin tone provides a good deal of contrast between the face and the background and does not change as the face rotates or moves.
  • 14. 14 Fig. 2.4 Hue image Step 3: Track the Face With the skin tone selected as the feature to track, you can now use the vision.HistogramBasedTracker for tracking. The histogram based tracker uses the CAMShift algorithm, which provides the capability to track an object using a histogram of pixel values. In this example, the Hue channel pixels are extracted from the nose region of the detected face. These pixels are used to initialize the histogram for the tracker. The example tracks the object over successive video frames using this histogram. Fig. 2.5 Tracked image
  • 15. 15  CAMShift Algorithm: 1. Set the region of interest (ROI) of the probability distribution image to the entire image. 2. Select an initial location of the Mean Shift search window. The selected location is the target distribution to be tracked. 3. Calculate a colour probability distribution of the region centred at the Mean Shift search window. 4. Iterate Mean Shift algorithm to find the centroid of the probability image. Store the zeroth moment (distribution area) and centroid location. 5. For the following frame, centre the search window at the mean location found in Step 4 and set the window size to a function of the zeroth moment. Go to Step 3.  Viola-Jones algorithm: Two features are selected for the task of face detection: 1. first feature: the region of the eyes is often darker than the region of the nose and cheeks 2. second feature: the eyes are darker than the bridge of the nose 3. Classifier can be constructed which reject many of the negative sub windows while detecting almost all positive instances. 4. The final detector is scanned across the image at multiple scales and locations 5. The detector is also scanned across location, by shifting the window some number of pixels 6. It is useful to post process the detected sub-windows in order to combine overlapping detections into a single detection
  • 16. 16 Fig. 2.6 Haar image  Detecting Respective Quadrant Of Class Room In Which Face Is Detected :  as shown in figure we can see that face is detected in each quadrant 1-2.  So in quadrant 2 face is detected Fig. 2.7 Quadrant divided image
  • 17. 17 2.6 RESULT  Camera Image Fig. 2.8 Camera image of room  Image SeparatedIn Quadrant Fig. 2.9 Quadrant divided image
  • 18. 18  Face DetectedIn Each & Every Quadrant Fig.2.10 Face detected in quadrant 2 2.7 LIMITATIONS  Multiple Face Tracking is Yet to implement  4 quadrant detection is yet to implement  Quadrants dimension are user defined not automatic  Photo Frames in room can reduce applicability of the program  Intially to start the process 1st frame with face detected is required 2.8 CONCLUSION The main concernof this project is to save the wastage of unwanted electricity. Although this can be done using various other methods but this project is proposed to control the home appliance automatically using MATLAB. This project is of low costand can be applicable to various places such as  Domestic application  Industrial application
  • 19. 19  Medical application  Military application The main advantages of this project is that the area used for installation of this project is very less and also it requires very less maintenance.
  • 20. 20 APPENDIX ProgramCode: clc,clear all,close all bodyDetector = vision.CascadeObjectDetector('UpperBody'); bodyDetector.MinSize = [20 22]; bodyDetector.MergeThreshold =10 ; videoFileReader = vision.VideoFileReader('classroom1.mp4'); videoFrame = step(videoFileReader); figure;imshow(videoFrame) videoFrame = step(videoFileReader); figure;imshow(videoFrame) %display image in 4 frames I1=videoFrame(1:240,1:160); I2=videoFrame(1:240,160:320); figure; subplot(1,2,1),imshow(I1); subplot(1,2,2),imshow(I2); % subplot(2,2,3),imshow(I3); % subplot(2,2,4),imshow(I4);
  • 21. 21 bbox1 = step(bodyDetector, I1); bbox2 = step(bodyDetector, I2); % Draw the returned bounding box around the detected face. videoOut = insertObjectAnnotation(I1,'rectangle',bbox1,'face'); figure, imshow(videoOut), title('Detected body'); videoOut = insertObjectAnnotation(I2,'rectangle',bbox2,'face'); figure, imshow(videoOut), title('Detected body'); videoInfo = info(videoFileReader); videoPlayer = vision.VideoPlayer('Position',[300 300 videoInfo.VideoSize+30]); flag1=0; flag2=0; while ~isDone(videoFileReader) % Extract the next video frame videoFrame = step(videoFileReader); I1=videoFrame(1:240,1:160); I2=videoFrame(1:240,160:320); bbox1 = step(bodyDetector, I1); bbox2 = step(bodyDetector, I2); % isempty return 0 if array have some values
  • 22. 22 f1=isempty(bbox1); f2 =isempty(bbox2); if f2==0 flag2=1 else flag2=0 end if f1==0 flag1=1 else flag1=0 end videoOut = insertObjectAnnotation(I1,'rectangle',bbox1,'face'); figure, imshow(videoOut), title('Detected body'); videoOut = insertObjectAnnotation(I2,'rectangle',bbox2,'face'); figure, imshow(videoOut), title('Detected body'); % Display the annotated video frame using the video player object step(videoPlayer, videoOut);
  • 24. 24 REFERENCES  Description book provided by Cranes Software International, Bangalore.  Matlab Image toolbox (Matlab 2017a)  Electricity Sector in India – Wikipedia  (https://en.wikipedia.org/wiki/Electricity_sector_in_India )  Image source – Google  MATLAB Help menu  Youtube – Matlab Image Processing  MATALB Reference note by Cranes Varsity