Sie sind auf Seite 1von 43

Contents

S.NO Chapter name Page no.

List of figures i

Abstract ii

1 Introduction 1

1.1 Introduction 1

1.2 Aim of the Project 2

1.3 Motivation 2

1.4 Literature Survey 2

1.5 Applications 3

1.6 Advantages 3

1.7 Disadvantages 3

1.8 Technical Approach 4

1.9 Organization of the Project 4

1.10 Conclusion 5

2 Hardware Components and Description 6

2.1 Introduction 6

2.2 Components of the system 6

2.2.1 Image Acquisition Device 7

2.2.2 Image Processing Device 9

2.2.2.1 Basic Image acquisition Tool box 9

2.2.2.2 Basic Image acquisition Procedure 9


2.3 Conclusion 11

3 Software Description and Programming 12

3.1 Introduction 12

3.2 The MATLAB system 13

3.2.1 Development Environment 13

3.2.2 The MATLAB mathematical function Library 13

3.2.3 The MATLAB Language 13

3.2.4 Handle Graphics 13

3.2.5 The MATLAB Application Program Interface(API) 13

3.3 Basic Building Blocks of MATLAB 14

3.3.1 MATLAB Window 14

3.3.1.1 Command window 14

3.3.1.2 Graphics or Figure window 14

3.3.1.3 Edit Window 14

3.3.2 On line Help 14

3.3.3. Files 15

3.3.3.1 M-Filles 15

3.3.3.2 MAT-Files 15

3.3.4 MIX-Files 16

3.4 Commands used in the Program 16

3.4.1 Imread 16

3.4.2 Imshow 16

3.4.3 Load 17

3.4.4 Size 17
3.4.5 Figure 17

3.5 Program Code 17

3.6 Conclusion 23

4 Results and Discussions 24

4.1 Introduction 24

4.2 Output-step1 25

4.3 Output -step2 26

4.4 Output-step3 27

4.5 Conclusion 28

5 Conclusion and Future scope 29

References 31
LIST OF FIGURES

2.1 Block diagram of basic components of the project ADROBO


2.2 Image Acquisition Device (Web Camera)
2.3 Block diagram of Web Camera
Abstract
The automatic advertising machine is advertisement system intended to design low power
consumption advertisement display using human detection. This project concept is
implemented using MATLAB and used to advertise automatically when detect the
human. It can be used at any public places with this we can control the unnecessary
playing of Advertisement and power consumption.
In the connections of the project web camera is used to detect the human being by using
image processing. The sensor output is connected to PC via USB connector.
When the MATLAB file runs it is continuously monitor the status of the sensor output
when the sensor detect the human its output state changes and the previously stored
advertisement will play on the GUI, when the human passed away from the robot it will
stop the playing of advertisement.
In today’s world advertising is a major investment for all the companies in order to sell
their products. One can use television, the radio, newspaper, magazines etc., and the
possibilities for advertising are infinite. Along with these there is a lot of recurring
expenditure for the cause. It is also not affordable to all firms to spent huge amounts on
the advertising. In this situation our project can work as a solution to some extent as it is
affordable, attractive, exciting and easy to use.
The project proposes a cost effective, autonomous advertising t. system with an image
processing system. The project is designed and detailed in such a way that the
autonomous robot is confined to a small area of activity such as malls, parks, offices;
robotic In this project we are having one camera and PC. In this the camera will capture
the video continuously from that specified area. The purpose of the PC is to display the
advertisement.
Chapter-1

Introduction
1.1 Introduction:
In the recent years there has been a tremendous development in the field of
wireless technology and its applications. The wireless technology has been effectively
used for various purposes in one’s daily life. These applications take on many tasks,
from a simple remote control to a million dollar space mission, all striking for one
common purpose that is to bring exceptional services, extended control and easy
operation.
If wireless technology is one of the major fields of interest in the business world,
the other which is yet to make an impression is the robotics. The field of robotics is still
new and the extent to which these two fields can take us is unimaginable as yet.
In today’s world advertising is a major investment for all the companies in order to
sell their products. One can use television, the radio, newspaper, magazines etc., and the
possibilities for advertising are infinite. Along with these there is a lot of recurring
expenditure for the cause. It is also not affordable to all firms to spent huge amounts on
the advertising. In this situation our project can work as a solution to some extent as it is
affordable, attractive, exciting and easy to use.
The project proposes a cost effective, autonomous advertising robotic system with
an image processing system. The project is designed and detailed in such a way that the
autonomous robot is confined to a small area of activity such as malls, parks, offices;
movie theatres etc., the advancements of the project are lot more exciting, the robots can
be design for surveillance as well.
The front end of the robot has the displaying devices such as a LCD monitor or a
projector and a image sensor. It also has audio input and output devices to interact with
people around. The backend of the robot deals with the GSM receiver, the AT Keyboard,
and the control system.
1.2 Aim of the project
The main aim this project is to reduce power consumption by implementing
various image processing techniques to detect human. To achieve this aim, the following
objectives are carried out
1. Various image processing functions are studied.
2. Image acquisition device that is, a web camera is used to acquire the image.
3. Image acquisition tool box is used to compare the captured image with the predefined
specifications of the human skin in RGB form.
4. Graphical User Interface is used to display the video which is nothing but the output
of our project.
1.3 Motivation of the project
These days, there is a huge advancement in the media in this communicating
world. Everywhere we find LCDs and Televisions displaying the messages and playing
advertisements throughout the day. Due to this a lot of power is being consumed even in
the absence of a viewer. Our project ADROBO overcomes this problem by detecting a
human being in the vicinity of the LCD by using camera which captures the face of the
human being and only then plays the advertisement. Saving the power is the major
motivation and also doing this project using MATLAB software made us interested.
1.4 Literature survey
1. Bouman .C and Liu .B. ‘Multiple Resolution Segmentation of Textured
Images’. IEEE Trans. Pattern Anal. Machine Intel, vol .13, no. 2, pp. 99-233,
1991.
2. Chanda .B ‘On Preprocessing techniques for Image Analysis’ ,Ph.D. thesis
University of Kolkata, 1988.
3. Chanda B, Chaudhuri .B.B and Dutta Majumber .D ‘On Image Enhancement
and threshold selection using gray level co-occurrence matrix ’ Pattern
Recognition Letter 3:243-251,1985.
4. Chaudhuri .B.B ‘A note on Fast Algorithm for Spatial Domain Techniques in
Image Processing ’. IEEE Trans. Syst. Man Cyb, vol. SMC-13, no. 6, pp. 1166-
1169, 1983.
5. Fu K.S and Muj .J.K ‘ A survey on Image Segmentation ’ Pattern
Recognition,13:3-16,1981.
6. ‘An introduction to MATLAB 6 for Scientists and Engineers ’ Champman.
7. ‘Getting Started with MATLAB 6 ’ A Quick Introduction for Scientists and
Engineers, Rudra Pratap.
1.5 Applications
1. In Banks, information such as job offers, loans and new schemes can be
displayed.
2. In Multiplexes, this project can be useful to display information about movies and
names of the
3. The timings and the information related to the destination can be displayed in bus
Stations and in airports, the information regarding the arrival and departure can be
displayed.
4. In schools and colleges, our project can replace the notice board.
5. In Industrial applications, such as displaying the offers and the brands which it
manufactures and about the new products.
6. Stock Exchanges.
7. Public Relation Offices
1.6 Advantages:
1. Reduced Power Consumption
2. Effective way of advertising
3. Audience attention is grabbed in a direct way
4. Reliability increases
5. Thermal Stability Increases
6. Life of the system increases
7. Robust
8. Performance increased
9. Maintenance cost is less
10.Cost effective Solution
1.7 Disadvantages:
1. Fails in crowdie environment
2. Human detection algorithm is little sensitive to lighting
3. Speed of operation is less

1.8 Technical Approach


I.MATLAB:

 This is a high-performance language for technical computing.


 It integrates computation, visualization, and programming in an easy-to-use
environment where problems
 Solutions are expressed in familiar mathematical notation
In this project we are using Matlab7.2 which has an added advantage of GUI
(Graphical user Interface) using which we can run our applications effectively.
I. Image acquisition:
The Image Acquisition is a process of acquiring the real images through acquiring
devices. This is done in the image acquisition tool box.
Acquiring images is done through many types of image acquisition devices, like
USB-based Webcams
II. Image windowing:
The windowing method involves multiplying the ideal impulse response with a
window function to generate a corresponding filter,
Here this technique is used to extract the exact portion of the video input
1.9 Organization of the project:
Chapter1 gives introduction, aim of the project, motivation, literature survey,
applications of the project, advantages and disadvantages, technical approach. Chapter2
discusses about the hardware components of the project with the block diagrams. It also
discusses the process of installation of image acquisition tool in detail in 5 different steps.
Chapter3 explains the software used in our project that is matrix laboratory. It discusses
in detail about the MATLAB system and also the basic building blocks of MATLAB
such as windows, files and commands. The MATLAB code for the project is included in
chapter3 along with the comments. Chapter4 deals with the results and discussions of the
project and the output which is displayed on the graphical user interface with explanation
below.

1.10 Conclusion:
We hereby conclude that in chapter1 we have discussed about the introduction,
aim of the project, the motivation and the literature survey. We also discussed about the
applications, advantages and disadvantages, technical approach and organization of our
project.
Chapter-2
Hardware Components and Description
2.1 Introduction
In this project we are having one camera and PC. In this the camera will capture
the video continuously from that specified area. The purpose of the PC is to display the
advertisement. And we have MATLAB Programming in the PC which will take one
image from that video and perform certain operations on that image. By this
programming we are going to detect the human face in the video.
PC will take one image from that video and will perform certain operations on that image
to detect the human face. When human face is detected it will display the advertisement
video in Graphical User Interface window.
In the program to detect the human face it has a code to detect the skin of the
human. When it crosses the threshold value then it displays the advertisement via
Graphical User Interface (GUI).
2.2 Components of the system:
1 . Image Acuisition Device (Web Camera)
2. Image Processing Unit (PC-MATLAB)
3.USB Connector.

PC

Image
Senor Playing
Web- USB cable Advertisement
camera

GUI
Fig 2.1 Block diagram of basic components of ADROBO
2.2.1 Image Acuisition Device (Web Camera)

Fig2.2: Image Acquisition


Device

A webcam is a video
capture device connected
to a computer or computer
network, often using a
USB port or, if connected
to a network, Ethernet or Wi-Fi.
The most popular use is for video telephony, permitting a computer to act as a
videophone or video conferencing station. This can be used in messenger programs such
as Windows Live Messenger, Skype and Yahoo messenger services. Other popular uses,
which include the recording of video files or even still-images, are accessible via
numerous software programs, applications and devices.
• Webcams are known for low manufacturing costs and flexibility,[1] making them
the lowest cost form of video telephony.
• The term 'webcam' may also be used in its original sense of a video camera
connected to the Web continuously for an indefinite time, rather than for a
particular session, generally supplying a view for anyone who visits its web page
over the Internet. Some of these, for example those used as online traffic cameras,
are expensive, rugged professional video cameras
USB
CMOS Sub- Device PC
image ISP Sample JPEG Control Host
sensor Raster Encoder ler

System Controller

ZC0201

Fig.2.3: Block Diagram of Web Camera


With a miniature 28-Pin PLCC package and without external DRAM, ZC0201 provides a
cost effective single chip solution for PC camera application. All major image
processing functions, image data compression, and data transfer units are built in the
chip. The ZC0201 chip communicates with PC host via Universal Serial Bus (USB) port.
In the connections of the project web camera is used to detect the human being by using
image processing. The sensor output is connected to PC via USB connector.
When the MATLAB file runs it is continuously monitor the status of the sensor output
when the sensor detect the human its output state changes and the previously stored
advertisement will play on the GUI, when the human passed away from the robot it will
stop the playing of advertisement.
2.2.2 Image Processing Unit(PC MATLAB)
All the Image Processing and display of images is developed in PC using MATLAB
Software. The MATLAB has both image Acquisition and Image Processing tool boxes.
The Graphical User Interface is made in the MATLAB software to acquire the image and
process and the display the advertisement.
2.2.2.1 Image Acquisition Toolbox
The Image Acquisition Toolbox is a collection of functions that extend the
capability of the MATLAB® numeric computing environment. The toolbox supports a
wide range of image acquisition operations, including Acquiring images through many
types of image acquisition devices, from professional grade frame grabbers to USB-based
Webcams.
2.2.2.2 Basic Image Acquisition Procedure
This section illustrates the basic steps required to create an image acquisition
application by implementing a simple motion detection application. The application
detects movement in a scene by performing a pixel-to-pixel comparison in pairs of
incoming image frames. If nothing moves in the scene, pixel values remain the same in
each frame. When something moves in the image, the application displays the pixels that
have changed value
To use the Image Acquisition Toolbox to acquire image data, you must perform the
following basic steps:
Step 1: Install Your Image Acquisition Device
Follow the setup instructions that come with your image acquisition
device.
Setup typically involves
• Installing the frame grabber board in your computer.
• Installing any software drivers required by the device. These are
supplied
by the device vendor.
• Connecting a camera to a connector on the frame grabber board.
• Verifying that the camera is working properly by running the
application software that came with the camera and viewing a live
video stream. Generic Windows image acquisition devices, such as
Webcams and digital video camcorders, typically do not require the
installation of a frame grabber board. You connect these devices
directly to your computer via a USB or FireWire port.
After installing and configuring your image acquisition hardware, start
MATLAB on your computer by double-clicking the icon on your desktop.
You do not need to perform any special configuration of MATLAB to
perform image acquisition.
Step 2: Retrieve Hardware Information:
In this step, you get several pieces of information that the toolbox
needs to uniquely identify the image acquisition device you want to
access.
Adaptor name An adaptor is the software that the toolbox uses to
communicate with an image acquisition device via its device driver.
The toolbox includes adaptors for certain
vendors of image acquisition equipment and for particular classes of
image acquisition devices. . Device ID The device ID is a number that
the adaptor assigns to uniquely identify each image acquisition device
with which it can communicate.
To determine the name of the adaptor, enter the imaqhwinfo function
at theMATLAB prompt without any arguments.
imaqhwinfoans =Installed Adaptors: {'dcam' 'winvideo'}
MATLABVersion: '7.2 (R2006a+)'
Toolbox Name: 'Image Acquisition Toolbox'
Toolbox Version: '2.0 (R2006a+)'
In the data returned by imaqhwinfo, the Installed Adaptors field lists
the adaptors that are available on your computer. In this example,
imaqhwinfofound two adaptors available on the computer: 'dcam' and
'win video'.
Step 3: Create a video input object
In this step you create the video input object that the toolbox uses to
represent the connection between MATLAB and an image acquisition
device. Using the properties of a video input object, you can control
many aspects of the image acquisition process. To create video input
object use video input function at the MATLABprompt. The Device Info
structure returned by the imaqhwinfo function contains the default
video input function syntax for a device in the Object Constructor
field.The following example creates a video input object for the ‘win
video’adaptor. Substitute the adaptor name of the image acquisition
device available on
your system .vid = video input('win video’).

Step 4: Acquire Image Data


After you create the video input object and configure its properties,
you can acquire data. This is typically the core of any image acquisition
application, and it involves these steps:
Starting the video input object: You start an object by calling the start
function. Starting an object prepares the object for data acquisition.
For example, starting an object locks the values of certain object
properties(they become read only). Starting an object does not initiate
the acquiring of image frames, however. The initiation of data logging
depends on the execution of a trigger. Objects stop when they have
acquired the requested number of frames. Because the example
specifies a continuous acquisition, you must call the stop function to
stop the object.
Triggering the acquisition: To acquire data, a video input object must
execute a trigger. Triggers can occur in several ways, depending on
how the Trigger Type property is configured. For example, if you
specify an immediate trigger, the object executes a trigger
automatically, immediately after it starts. If you specify a manual
trigger, the object waits for a call to the trigger function before it
initiates data acquisition.
Step 5: Clean Up
When you finish using your image acquisition objects, you can remove
them
from memory and clear the MATLAB workspace of the variables
associated
with these objects.
delete(vid)
clear
close(gcf)
2.3 Conclusion:
In chapter-2 we have discussed about hardware components and
description and its introduction, the components of the system which
are image acquisition device, image processing unit and the USB
connector and steps to use the image acquisition toolbox.

Chapter-3
Software Description and Programming

3.1 Introduction:
MATLAB is a 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
notation. Typical uses include:
• Math and computation
• Algorithm development
• Modeling, simulation and prototyping
• Data analysis, exploration and visualization
• Scientific and engineering graphics
• Application development, including graphical user interface building
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 formulations, in a
fraction of the time it would take to write a program in a scalar non interactive
language such as C or FORTRAN.
The name MATLAB stands for “Matrix laboratory”. MATLAB was
originally written to provide easy access to matrix software developed by the
LINKPACK and EISPACK projects. Today, MATLAB uses software developed
by the LAPACK and ARPACK projects, which together represent the state of the
art in software for matrix computation.
MATLAB features a family of applications 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 (M-files) that extend the MATLAB environment to solve
particular classes of problems. Areas in which toolboxes are available include
signal processing, control system, neural networks, fuzzy logic, wavelets,
simulation and many others.
3.2 The MATLAB System
The MATLAB system consists of five main parts
3.2.1 Development environment:
This is the set of tools and facilities that help you use MATLAB function
and files. Many of these tools are graphical user interfaces. It includes the
MATLAB desktop and command window, a command history and browsers for
viewing help, the workspace, files and the search path.
3.2.2 The MATLAB Mathematical function library:
This is a vast collection of computational algorithms ranging from
elementary functions like sum, sine, cosine and complex arithmetic, to more
sophisticated functions like matrix inverse, matrix Eigen values, Bessel
functions and fast Fourier transforms.
3.2.3 The MATLAB language:
This is a high-level matrix or array language with flow statements,
functions, data structures, input/output and object oriented programming
features. It allows both “programming in the small” to rapidly create quick and
dirty throw-away programs and “programming in the large” to create complete
large and complex application programs.
3.2.4 Handle Graphics:
This is the MATLAB graphics system. It include high-level commands
for two-dimensional and three dimensional data visualization image processing,
animation and presentation graphics. It also includes low level commands that
allow you to fully customize the appearance of graphics as well as to build
complete graphical user interfaces on your MATLAB applications.
3.2.5 The MATLAB Application Program Interface (API):
This is a library that allows to write C and FORTRAN programs that
interact with MATLAB. It include facilities for calling routines from MATLAB
(dynamic linking), calling MATLAB as a computational engine and for reading
and writing MAT-files.
MATLAB consists of toolboxes, collection of specialized functions useful
in the applications such as symbolic computation, image processing, control
system design and neural networks.
3.3 Basic Building Blocks Of MATLAB
The basic building block of MATLAB is MATRIX. The fundamental data
type is the array. Vectors, scalars, real matrices and complex matrix are handled
as specific class of this basic data type. The built in functions are optimized for
vector operations. No dimension statements are required for vectors or arrays.
Some of the basic features and commands of the MATLAB are:
3.3.1 MATLAB Window
The MATLAB works through three basic windows.
1. Command window
2. Edit window
3. Graphics window
3.3.1.1Command Window
This is the window, which characterized by MATLAB command prompt “ >>
”. It is opened when the application program is launched. All commands
including user-written programs are typed in this window at MATLAB prompt for
execution
3.3.1.2 Graphics or Figure Window
The output of all graphic commands typed in the command window is seen in
this window.
3.3.1.3 Edit Window
In this window one can write, edit, create and save programs in files called M-
files. MATLAB provides it own built in editor.
3.3.2 On Line Help
MATLAB provides online help for all it’s built in functions and programming
language constructs.
The general commands are:
Help lists topics on which help is available
Help win opens the interactive help window

Helpdesk opens the web browser based help facility


Help ‘topic’ provides help on “topic”
Look for ‘string’ lists help topics containing “string”

Demo runs the demo program

3.3.3 Files:
MATLAB has three types of files for storing information. They are
3.3.3.1 M-files
These are standard ASCII text file with ‘m’ extension to the file
name. You can create your matrices using M-files, which are text files
containing MATLAB code. Use the MATLAB editor or another text editor to
create a file containing the same statements you would type at the MATLAB
command line. Save the file under a name that ends in .m.
There are two types of M-files
I. Script files:

It is an M-file with a set of MATLAB commands in it and is executed by


typing name of file on the command line. These files work on global variables
currently present in that environment.
II. Function files:
A function file is also a M-file except that the variables in a function file
are all local. This type of files begins with a function definition line, syntax as
follows.
Function [Output Variables] =Function name (Input Variables):
Where the function name must be same as the file name (With out the ‘m’
extension in which the function is written)
3.3.3.2 MAT-files
These are binary data files with .mat extension to the file that are created by
MATLAB when the data is saved. The data written in a special format that only
MATLAB can read. These are located into MATLAB with ‘load’ command.

3.3.4 MIX-files
These are MATLAB callable FORTRAN and C programs with .mix
extension to the file name.
3.4 Commands Used In The Programs
3.4.1 Imread: Read image from graphics file.
A=IMREAD (FILENAME.FMT) reads in image in FILE NAME into
A. If the file contains a gray scale intensity image, A is a two-dimensional array.
If the file contains a true color (RGB) image, A is a three-dimensional (M-by-N-
by-3) array. FILENAME is a string that specifies name of the graphics file and
FMT is a string that specifies the format of the file. The file must be in the current
directory or in a directory on the MATLAB path. If IMREAD cannot find a file
named FILENAME, it looks for a file named FILE NAME.FMT.
The possible values for FMT include:
‘jpg’ or ‘jpeg’ Joint Photographic Experts Group (JPEG)
‘tif’or ‘tiff’ Tagged Image File Format (TIFF)
‘gif’ Graphics Interchange Format (GIF)
‘bum’ Window Bitmap (BMP)
‘png’ Portable Network Graphics
‘hdf’ Hierarchical Data Format (HDF)
‘pcx’ Windows Paintbrush (PCX)
‘xwd’ X Window Dump (XWD)
‘cur’ Windows Cursor Resource (CUR)
‘ico’ Windows Icon Resource (ICO)

3.4.2 Imshow: Display image.


IMSHOW (I, N) displays the insensitive image I with N discrete levels of gray.
If your omit N, IMSHOW uses 256 gray levels on 24 bit displays or 64 gray levels
on other system.
IMSHOW (FILE NAME) displays the image stored in the graphics
file FILENAME. IMSHOW calls IMREAD to read the image from the file, but
the image data is not stored in the MATLAB workspace. The file must be in the
current directory or on the MATLAB part.
3.4.3 Load: Load workspace variables from disk.
LOAD FILENAME retrieves all variables from a file given a full path name or a
MATLABPATH relative partial pathname (see PARTIALPATH). If
FILENAME has no extension, LOAD looks for a FILENAME and FILENAME.
mat and treats it as binary “MAT-file”. If FILENAME has an extension other
than .mat, it is treated as ASCII.
3.4.4 Size: Size the matrix
D=SIZE (X), for M-by-N matrix X, returns the two element row vector D= [M,
N] containing the number of rows and columns in the matrix. For N-D arrays,
SIZE(X) returns a 1-by-N vector of dimension lengths. Trailing single tone
dimensions are ignored. [M, N]=SIZE(X) returns the number of rows and
columns in separate output variables [M1, M2, M3 …MN] =SIZE(X) returns the
length of the first N dimensions of X.
3.4.5 Figure: Create figure window

FIGURE, by itself, creates a new figure window and returns its handle.
FIGURE (H) makes H the current figure, forces it to become visible and raises it
above all other figures on the screen. If FIGURE (H) does not exist and H is an
integer, a new figure is created with handle H.
3.4 Algorithm:
Step1: Align the system, align flag=1, it means web camrra is activated, it starts
capturing the images in front of it.
Step2: Prints the given string, ‘ Video Capturing Started’, on edit box.
Step3: The captured images are displayed on the axes3 with frame gap 1 count.
Step4: When ‘finish’ push button is pressed alignflag=0, it means alignment is
stopped.
Step5: Prints the given string, ‘Image alignment finished’, on edit box.
Step6: The video in axes3 is stopped. The last captured image is displayed on
axes3 and clears the video object.
Step7: Waits for the start push button to be pressed.
Step8: When start push button is pressed, assigns start flag=1.
Step9: Prints the given string, ‘loading…please wait’, on the edit box.
Step10: Video object is initialized.
Step11: Prints given string, ‘Live video started’, on the edit box.
Step12: Selects axes1 to display the image from ‘5.jpg’ file.
Step13: The last frame captured by the camera i.e, the image displayed on the
axes3 is copied to the video object initialized in Step10.
Step14: The video object which is in RGB form is passed to the face function
which will detect the skin tone and returns the same image in Black and White
form.
Step15: The image is now passed through the medium filter. It removes the black
dots in white area and white dots in black area.
Step16: The shapes of each white area are stored in an array.
Step17: The shape with maximum value in array is stored and the boundaries are
calculated.
t- 1st column 1st pixel value.
r- last column last pixel value.
b- 1st column last pixel value.
l- last column first pixel value.
Step18: The values t, r, b, l are passed to an array [l, t, r, b].
Step19: A rectangle is drawn around the boundaries of the selected shape.
Step20: Height and Width of the shape are calculated,
H= abs(t-b)
W=abs(r-l)
Step21: AR=H/W.
Step22: The pixel values inside the rectangle are summed up and the value is
assigned to k.
Step23: If (k>1000) and (AR>0.85) and (AR<1.5) then it prints given string,
‘Welcome’ on the edit box and the videos present in different files are displayed
one by one depending on the modes assigned to them. The start flag status is
checked at every mode.
Step24: If start flag=0, then it goes to Step27 else it continues displaying the video
present in the next mode.
Step25: After completion of the display of video in the last mode, it checks the
status of the start flag.
Step26: If startflag=1 then it goes to mode1 and starts playing the videos again
else go to step27.
Step27: Stop video object.
Step28: Clears video object.

Conclusion:
In chapter-3 we have discussed about the software description that is the MATLAB
system, the basic building blocks of MATLAB such as commands, windows, files and
the program code of the project including with comments

Chapter-4
Results and Discussions
4.1 Introduction:
In this chapter we will discuss the output which is displayed on the Graphical
Interface Unit in 3 steps after the execution of the software programming code discussed
in the chapter3.

The basic window of Graphical User Interface of our project with name adrobo_gui is
shown below:

It consists of three axes, one edit box and five push buttons. Their functions are discussed
below:
• The three axes out of which one is used to display the image which is acquired by
web camera. The second axes is used to display the processed image in black and
white format. Whereas the third axes is used to display the video which is the
result.
• The edit box is named ‘status’ as it indicates the status of the program.
• The five push buttons are Align Systems, Finish, Start, Stop and Reset.
4.2 Output-Step1:

When the push button named ‘Align System’ is clicked or pressed, the camera starts
capturing the images in its vicinity and displays the image on the first axes.
After pressing the ‘Finish’ push button, the image captured at that instant is taken as input
to the program and displays the same image on the first axes throughout the process of
execution.
In this step, the ‘status’ edit box displays the status of the process that is ‘video capturing
started’.

4.3 Output-Step2:
In this step, the push button ‘start’ is pressed. Now the actual processing of the
image starts. The image captured on the first axes is converted to black and white image
and displayed on the second axes. It then compares the selected pixels or portions of the
image with the predefined specifications of human skin written in the program code.
If the comparision is matched, then the following step takes place
In this step, the ‘status’ edit box displays the status that is ‘monitoring’.

4.4 Output-Step3:
In this step, the video that is the output is displayed. This is because the captured
image is matched with the specifications of the human skin written in the the program
code which is nothing but the aim of our project. Since the output is displayed, it
indicates that the aim of our project is achieved and the required result is obtained.
If in case the human is not detected that is if the specifications are not matched the video
will not be displayed.
The ‘status’ edit box displays ‘welcome’ which means it welcomes the viewer to watch
the video.
The ‘stop’ push button is pressed to stop or interrupt the process of execution at any step
or any time instant. The video being displayed can be stopped by pressing the ‘stop’ push
button.
The ‘reset’ button is pressed to stop the execution and to perform the whole execution
from the beginning.
4.5 Conclusion:
In chapter-4 we have discussed about the results and discussions, the output
which is displayed on the graphical user interface and its working in step-1, step-2 and
step-3.

Chapter 5
Conclusions and Future scope
Our project has helped us in understanding the importance of MATLAB and image
processing. To develop the required software program MATLAB is used, it is a high
performance language for technical computing. It integrates compution, visualization and
programming in an easy way to use environment, as this allows us to solve computing
problems, especially those with matrix and vector formulations in a fraction of time
where as in a scalar non interactive language such as C and FORTON it is complicated.
Image processing has many applications in various fields and various image
processing functions have been studied and used in our project. In this project we have
used image acquisition tool in automatic advertising machine, in which advertisement is
played automatically on the basis of human detection that is in the presence of human
beings. This is possible with the help of sensors. The sensors used in our project is image
acquisition device i.e the web camera is used to acquire an image and displays the
captured image on an axes of the Graphical user interface. Image acquisition tool box is
used to compare the captured image with the predefined specifications of the human skin
in the RGB form. If it is matched i.e the human skin is detected. Then GUI displays the
output i.e the video. The main advantage of our project is its less power consumption and
it can be applied in various fields using the principle of human detection like banking
advertisements, railway stations, multiplexes, bus stations, airports, schools and colleges,
industrial applications, stock exchanges and public relation offices etc. Here we
mentioned less power consumption because the video is displayed only in the presence of
the human otherwise it is not. The power can be saved as the LCD will be in the stand by
mode when it is not displaying. As there are limited natural resources like water, natural
gas and natural oils which will soon deplete in the near future. Thus, power should not be
wasted. Our project holds good in conserving electricity and is affordable, attractive,
exciting and easy to use.
In the recent years as there is tremendous development in the technology and its
applications. Wireless technology and robotics are the two fields where our project can be
extended and developed in the near future. The wireless technology is one of the major
fields being developed in the business world and robotics is a fast growing field but yet to
make an impression. On the basis of skin detection an information can be sent in the
presence of a person through wireless technology where the information sent will be
secured and the operation provides security. This project with advanced features can also
be used in defense and army. That is on the basis of skin detection it can identify a
human being entering into the borders but displaying this information or news can be
viewed on the mobiles or LCDs located far away where commandos stay so that they
take an action. Our project of advertising automatically in the presence of human being
but also can be implemented in various fields such as airports, railway stations, banks,
multiplexes and to display the stock exchanges. It can occupy every place of an LCD as it
is low in price, inexpensive and has a attractive and sophisticated look. However the main
advantage and the aim is to reduce the power consumption.

References:
1. William J. Palm, ‘Introduction to MATLAB 7 for Engineers’, 2nd edition.
2. William K. Pratt, John Wilely, ‘Digital Image Processing’, 3rd edition, 2007.
3. Rafel C. Gonzalez, Richard E. Woods and Steven L. Edition, ‘Digital Image
Processing using MATLAB’, PEA, 2004.
4. Chaudari.B.B, ‘A note on fast Algorithm for Spatical Domain Techniques in
Image Processing’, 1st edition, 1983.
5. Scott I. Mackenzie and Raphael Chung Wei Phan, ‘8051 Micro controller’, 4th
edition.
6. A.K. Jain, ‘Fundamentals of Digital Image Processing’, 4th edition, PHI.
7. Rudra Pratap, ‘Getting started with MATLAB 6’, 2nd edition, 2004.

Appendix
Progra
m Code: Comments
Function pushbutton4_callback(hobject,eventdata,handle) //called when system
alignment is pressed
global alignFlag // intialising a global variable alignflag
axes(handles.axes3); //selecting axes3 to show the video
vid = videoinput('winvideo'); //video object is intialised using adapter win video
pause(2); //provides a delay of 2 counts
set(vid,'TriggerRepeat',Inf); // calling trigger function infinite times
vid.FrameGrabInterval = 1; //taking frames from the camera with gap 1 count
alignFlag = 1; //assigns align flag to 1
start(vid); //starting video
set(handles.status,'String', 'Video Capturing Started'); //prints the given string on
edit box of gui
pause(1); //provides a delay of 1 count
while alignFlag == 1, //entering into loop
origIm = getdata(vid,1); //get the new gray scale image
imshow(origIm), //shows the image on axes3
end //end of while loop that is when align flag is 0
stop(vid); //stops the video
set(handles.status,'String', 'Image Alignement Finished'); //prints the given string on
edit box
delete(vid); //delete the video object
clear vid; //clears the video object
pause(1); //provides adelay of 1 count

Function push button5_callback(hobject, eventdata, handle) //called when finish button


is pressed

global alignFlag; //initializing the global variable alignflag


alignFlag = 0; //assigning the alignflag is 0
Function start_callback(hobject,eventdata,handles) // called when start button is pressed

global startflag, // global start flag to stop infinite loop present in this function
startflag=1; //start flag assigned to 1
set(handles.status,'String','loading...please wait....'); //it prints the given string on edit box
pause(0.1); //provides a delay of 0.1 count
vid=videoinput('winvideo'); //video object is intialised using adapter win video
set(handles.status,'String','live video starting..'); //it prints the given string on edit box
pause(0.3); //provides a delay of 0.3 counts
axes(handles.axes1); //select the axes 1to show the image
imshow('5.jpg'); // shows the image on the selected axes1
vid.FrameGrabInterval = 60; //taking frames from the camera with gap 60 counts
set(vid,'FramesPerTrigger',1); //to set taking frames when trigger called in 1 frame
set(vid,'TriggerRepeat',Inf); //calling trigger function infinite times
triggerconfig(vid, 'Manual'); //to allow the manual setting on video

mode = 1; //this mode variable is used to intimate which advertisement has to be played
start(vid); //starting the video
i = 1; // assigning local variable to 1
k= 1; //assigning local variable to 1

while startflag==1, //loop will be executed until start flag is 1


i = i + 1; //increment i with 1
ary = []; //creating array
trigger(vid); //by trigger function we are taking frames from camera
im=getdata(vid,1); //latest frame is copied from video object
axes(handles.axes2); //selecting axes2
imshow(im); //shows the image of ‘im’ image on axes 2
if i > 1, //if cheking condition it is true it executes following statements
finImage = face(im); //im is passed to face function which will ditect skin tone and
returns black and white image
finImage = medfilt2(finImage); //medium filter is used to remove black dots in white
area and white dots in black area.
finImage = imfill( finImage,'holes'); //in white area black dots are removed perfectly.
boundaries = bwboundaries(finImage); //collect shape information and store in
boundaries in the form of array

for j = 1:size(boundaries,1), //how many shapes present that many loops are executed
ary(j) = size(boundaries{j},1); //first loop j is 1 and boundaries(1) means first shape
is in ary(1)
end//end of for loop

if size(ary,1)~=0, //if there is no skin detected, there is no shape, means this condition
get false
[mbound ind] = max(ary); //in the array which shape has a maximum value is stored in
index and the value is stored in mbound
C = boundaries{ind}; //set boundaries to the shape

t = min(C(:,1)); //the first column first pixel value is stored in t variable


r = max(C(:,2)); //the last column last pixel value is stored in r variable
b = max(C(:,1)); //the first column last pixel value is stored in b variable
l = min(C(:,2)); //the last column first pixel value is stored in l variable
[l t r b] //array with boundaries
axes(handles.axes2); //axes 2 selection
imshow(finImage); //shows the image finimage on axes 2
hold on; //holding the image
rectangle('Position',[l,t,r-l,abs(b-t)],'LineWidth',3,'LineStyle','-'); //draws the
rectangular to that shape
hold off; //holding off the image
set(handles.status,'String','monitoring...'); //print the given string on edit box
H = abs(t-b) //height of the shape is stored in H variable
W = abs(r-l) //width of the shape is stored in W variable
AR = H/W //ratio of height to width is stored in AR
cropFace = finImage(t:b,l:r); //matrix with given dimensions is stored in cropface
k = sum(sum(cropFace)); //summing all elements ofcropface and assigned to k
if k>1000 && (AR > 0.85) && (AR < 1.5), //to filter the small shapes less than
thousand and which are in our ratio
disp(k); //diplays the k value in command window
if mode == 1, //checks the mode
axes(handles.axes1); //selecting the axis 1
set(handles.status,'String','welcome'); //prints welcome on the edit box
for i=1:300, //for 300 snap shots this loop continues
if startflag==0, // checking start flag
break; //stop the loop when start flag is zero
end //end of for loop
str=strcat('Frames\Bmw\Bmw',int2str(i),'.jpg'); % Video File
img=imread(str); //alternating playing of video
imshow(img); //showing the img image
pause(0.001); //provides delay of 0.001 counts
end //end of video playing
mode = 2; // selecting next video
elseif mode == 2, // checking mode 2
axes(handles.axes1); //selecting the axes for 1
set(handles.status,'String','welcome'); //prints the string welcome on edit box
for i=1:300, //for 300 snapshots this loop continues
if startflag==0, //checking the start flag
break; //breaks the loop when start flag is 0
end //end of for loop
str=strcat('Frames\Bmw1\Bmw',int2str(i),'.jpg'); % Video File
img=imread(str); //alternating playing of video
imshow(img); //showing the img image
pause(0.001); //provides a delay of 0.001counts
end //end of video playing
mode = 1; //assign the mode to 1 to continue the video
end //end of if
end //end of if
end //end of if
end // end of if

axes(handles.axes1);
imshow('5.jpg');

end //end of while loop


stop(vid); //stops video
pause(1); //provides delay of 1 count
set(handles.status,'String','done sucessfully'); //print the corresponding string on edit box
axes(handles.axes1); //selecting the axes 1
imshow('5.jpg'); //shows the image named 5.jpg on axes 1
delete(vid); //delete the video object
clear vid; // clear the video object

Function stop _callback(hobject,eventdata,handles) //called when stop button is pressed


global startflag , //intailize the startflag
startflag=0; //startflag is assigned to 0 to stop the advertising process

set(handles.status,'String','stopped video....') //prints the given string on edit box


Function reset_callback(hobject,eventdata,handles) //called when reset is pressed
global startflag, //initialize the startflag
startflag=0; //assign the startflg to zero

Das könnte Ihnen auch gefallen