Controlling Computer Using Hand Gesture Recognition
Controlling Computer Using Hand Gesture Recognition
CHAPTER 1
INTRODUCTION
1.1 Introduction:
Another advantage is that the user not only can communicate from a distance, but
need have no physical contact with the computer. However, unlike audio commands, a
visual system would be preferable in noisy environments or in situations where sound
would cause a disturbance. The visual system chosen was the recognition of hand
gestures. The amount of computation required to process hand gestures is much greater
than that of the mechanical devices, however standard desktop computers are now quick
enough to make this project hand gesture recognition using computer vision — a viable
proposition. This interface is simple enough to be run using an ordinary webcam and
requires little training.
1
Controlling Computer Using Hand Gesture Recognition
1) A simplification used in similar type of projects, which was not found in any
recognition methods researched, is the use of a wrist band to remove several degrees of
freedom. This enabled three new recognition methods to be devised. The recognition
frame rate achieved is comparable to most of the systems in existence (after allowance
for processor speed) but the number of different gestures recognized and the recognition
accuracy are amongst the best found. Figure shows several of the existing gesture
recognition systems along with recognition statistics and method.
2
Controlling Computer Using Hand Gesture Recognition
One task which is especially cumbersome to perform with the mouse is moving
and resizing open windows. This is something that many computer users do quite often -
opening several applications, folders, browser windows, etc. on their screen, and then
switching between them frequently. But, on most computers, the only way to move a
window is by clicking and dragging it by its header/title bar, and the only way to resize is
by clicking and dragging on the bottom-right corner. This can be annoying to do for
managing multiple windows, which is the problem that this application aims to solve.
3
Controlling Computer Using Hand Gesture Recognition
4
Controlling Computer Using Hand Gesture Recognition
Plan of our project is given below. 1st part of plan contains whole image
processing. There are lots of steps to be performed in image processing given below. 2 nd
part contains only gesture implementation part which uses system programming for
implementation as shown below.
Part 1:
Image processing
Video capturing from camera.
Detecting wristband from image.
Calculating wrist band to hand ratio.
Calculating region of interest.
Skin pixel detection.
Hand segmentation.
Hand detection and identification of gestures.
Part 2:
Gesture implementation
Perform mouse operations depending on hand gestures.
Perform few keyboard operations like navigation keys,
numbering from (0 to 5).
Block diagram of project is given below:
5
Controlling Computer Using Hand Gesture Recognition
Block diagram of this project shown above has six blocks like capture image,
detect wristband, hand segmentation, hand detection, gesture detection and gesture
implementation etc.
Capture image is nothing but capturing video input through camera. This input is
given for image processing in further steps. If camera quality is better, captured video is
also better and results to be achieved are also better and efficient. This captured video is
given to next step called as detect wrist band. While using this system user should have
wrist band tied with his/her hand. Without wrist band system is not going to work. Detect
wrist band step scans whole image and selects region of interest where wrist band is
present. Only region of interest of wrist band is detected here no other processing is done.
Next step is hand segmentation. In this step region of interest above the wrist
band where probable hand is present is determined and only that much area is used for
SCOE, Information Technology, 2010-11.
6
Controlling Computer Using Hand Gesture Recognition
further processing. Skin pixels present in that area is detected, which are nothing but skin
pixels of our hand. In this way hand is segmented. For every people wrist band to hand
ratio is approximately constant so it is beneficial to us while segmenting hand.
Segmented hand is given for hand detection technique. Here two techniques
namely convex hull and convex defect are used for actual detection of hand. Convex hull
technique joins extreme points of polygon which are present in certain area. In our
project convex hull technique joins points which are present on tip of every finger with
each other and to the base of palm. Furthermore convex defect technique calculates actual
defects present between fingers. In this way actual hand is detected.
Detected hand is given for further processing. Gesture detection technique takes
this hand and identifies gestures. Detected gesture could be related to left click, right
click or number counting from 0 to 5.
7
Controlling Computer Using Hand Gesture Recognition
8
Controlling Computer Using Hand Gesture Recognition
b) System Design:
The requirements that are gathered in the previous phase are broken down
into logical units, so that the software process becomes easy for implementation.
This is the stage, when the software requirements along with the hardware
requirements for every unit are identified. Then the designs are made accordingly.
c) System Implementation:
In this phase the actual development of the software takes place. This
phase is also known as coding and verification phase. Based on the algorithms
written in the previous phase, software program is written.
9
Controlling Computer Using Hand Gesture Recognition
various modules as modules are small and easy to implement compared to whole
system at a time.
In this phase all the modules are integrated, after which the software is
tested for correct output. All the bugs introduced due to integration are removed.
There are number of techniques are used for integration and testing depending on
efficiency of technique. Testing techniques used here are unit testing for
individual module, integration testing for integrated modules and system testing
for testing whole system.
This makes for the final phase of the waterfall model, where the software
is deployed at the user side, after it has undergone thorough testing. After the
deployment of the software, routine maintenance work is carried out. In
maintenance phase software is repaired if any problem occurs and returned back
to user. There must be maintenance phase after delivery of software as it
beneficial for maintaining good relationship with customers.
10
Controlling Computer Using Hand Gesture Recognition
Works well for smaller projects where requirements are very well
understood.
CHAPTER 2
REQUIREMENT GATHERING
11
Controlling Computer Using Hand Gesture Recognition
Basic purpose is to develop system such that we are able to operate computer
with the help of hand gestures without using mouse. This project helps us in introducing
new computer interface, provided interface will be more natural and user friendly. It also
reduces physical contact with devices and minimizes hardware required for interfacing.
In this project wrist band of single color is used. We first detect wristband using
camera, and calculates region of interest. Wrist band helps in removing background.
Camera detects skin color and segment hand from background image. Finally hand
gesture is identified and respective operations are performed on computer.
12
Controlling Computer Using Hand Gesture Recognition
2.2 Vision:
13
Controlling Computer Using Hand Gesture Recognition
2.2.2 Scope:
2. Detection of wristband:
User has to use wrist band while using this system. Without wristband it is
impossible to use system. Wrist band of yellow color with width of 4cm is used.
This project first detects wrist band and finds region of interest of wrist band.
Wrist band helps in easily segmenting hand from background image.
14
Controlling Computer Using Hand Gesture Recognition
Probable area of hand is determined using wrist band. Only probable area
of hand is scanned for next step. cvRectangle() is OpenCv function to determine
region of interest. Skin detection technique is used within region of interest so that
actual hand is detected. Only region of interest is considered and remaining
portion of image is ignored. In this way processing region is reduced and
processing time is saved here. This segmented hand is given for further
processing.
In above step actual hand is not detected. Convex hull and convex defects
techniques are used to calculate exact hand. Convex hull technique calculates
contour of hand including finger tips. Convex defect technique used to calculate
defects in between fingers. In this way actual hand is traced out.
5. Implementation of gestures:
2.2.3Requirements:
SCOE, Information Technology, 2010-11.
15
Controlling Computer Using Hand Gesture Recognition
Computer:
Webcam:
b) Operating Systems:
WindowsXP OS:
16
Controlling Computer Using Hand Gesture Recognition
OpenCV Libraries:
Dev C++:
Dev C++ is the main editor used for coding purpose. In order to use
OpenCV library, we have configured OpenCV with DevC++. Configuration
includes adding library paths for .lib files, .bin files, include files for both C as
well as C++.
d) Network requirement :
e)Other Requirements :
17
Controlling Computer Using Hand Gesture Recognition
We have used yellow color wrist band of width approximately 4 cm. This
band is helpful for segmenting hand from background image. This band avoids
extra work needed for subtracting background from foreground. In this way it
reduces extra efforts and adds flexibility to our projects.
For best use of this system we must require good camera and user with at
least a hand. Here we have defined some conventions for operations such as left-
click, right-click etc. Depending on gestures recognized specific operations are
performed on computer.
System should easily capture hand images and should give quick response
to the hand gestures to perform respective operations. It should support maximum
requirements of user. It should provide better flexibility to the user. It should have
better efficiency and minimum drawbacks.
2.3.1 Introduction
SCOE, Information Technology, 2010-11.
18
Controlling Computer Using Hand Gesture Recognition
2.3.1.1.Problem Statement:
Controlling Computer Using Hand Gesture Recognition
2. Detection of wristband:
User has to use wrist band while using this system. Without wristband it is
impossible to use system. Wrist band of yellow color with width of 4cm is used.
This project detects wrist band and finds region of interest of wrist band. Wrist
band helps in easily segmenting hand from background image.
Probable area of hand is determined using wrist band. Only probable area
of hand is scanned for next step. cvRectangle() is OpenCV function to determine
region of interest. Skin detection technique is used within region of interest so that
actual hand is detected. Only region of interest is considered and remaining
portion of image is ignored. In this way processing region is reduced and
processing time is saved here. This segmented hand is given for further
processing.
19
Controlling Computer Using Hand Gesture Recognition
In above step actual hand is not detected. Convex hull and convex defects
techniques are used to calculate exact hand. Convex hull technique calculates
contour of hand including finger tips. Convex defect technique used to calculate
defects in between fingers. In this way actual hand is traced out.
5. Implementation:
After detecting hand gestures, are implemented with the help of system
level programming which contains windows.h file of system. Some amount of
system level programming is required to be implemented here. Performing the
PC control activities depending upon gesture recognized such as:
20
Controlling Computer Using Hand Gesture Recognition
Camera used can be a simple webcam. We need to capture the live feed of
camera. One solution to this can be OpenCV. We can use OpenCV library which
is supported on common operating systems like Windows and Linux. Captured
video is given for processing. Program is written using OpenCV libraries.
OpenCV library has lots of functions related to image processing and GUI
programming. Camera quality affects lots of things in processing.
21
Controlling Computer Using Hand Gesture Recognition
Wrist band detection is crucial step in this project. It has many advantages
over other techniques. A yellow color wristband is used in this project. As name
suggests wrist band is tied with wrist. Captured image is scanned for identifying
band. If there is no band present in image, system is not going to work properly.
Wrist band helps in removing background image from foreground image.
Background subtraction is very difficult task in this project, which is made easier
by wrist band detection technique.
22
Controlling Computer Using Hand Gesture Recognition
23
Controlling Computer Using Hand Gesture Recognition
3. Segmentation of hand:
After detecting wrist band, wrist band to hand ratio is calculated for
determining region of interest of hand. In this region of interest (ROI) skin pixel
detection technique is used in order to detect hand. Only region of interest is
scanned in further phases. The R-G-B values of the skin can be used to separate
out pixels of skin from the background.
24
Controlling Computer Using Hand Gesture Recognition
4. Recognizing hand:
There are two techniques to detect exact hand from ROI. These are convex
hull and convex defect. Convex hull technique joins extreme points of hand
including finger tips. It forms polygon of hand whose points are connected.
Convex defect technique finds actual defects in between fingers to give exact
image of hand. After getting exact image of hand we fill that image with color
which is less used in environment.
Screen shot below shows segmented hand, ROI of wrist band along with
separated hand from whole background.
25
Controlling Computer Using Hand Gesture Recognition
26
Controlling Computer Using Hand Gesture Recognition
27
Controlling Computer Using Hand Gesture Recognition
After recognizing the gesture we can evaluate its meaning and do the
action which is meant to be done. Some amount of system level programming is
required to be implemented here. Performing the PC control activities depending
upon gesture recognized such as cursor movements like up, down, left and right
etc. left click, right click, double click and numbers counted from 0 to 5.
This method has a problem. If the resolution of the desktop window has a
higher resolution than the camera resolution, then the cursor position cannot be
accurate because when the camera resolution converts to the desktop window
resolution we lose intermediate value. We expect the ratio of jumping pixel is up
to 4 pixels. Another problem is when any one of the finger goes outside the
camera boundary then gesture is not identified properly. Cursor gets moved
according to center of wrist band only if index finger is straight and all other
fingers are curled. This method gives more accurate results.
28
Controlling Computer Using Hand Gesture Recognition
To call system event for left clicking, at least two convex hull vertexes
have to be off the palm area which was computed in the previous part. In addition,
the x position of one of two vertexes should be lower than the other to restrict
detection of other finger tips. When the degree of the index finger and thumb is 70
to 90 degree then we can recognize that the gesture is left clicking. Actually, if the
thumb is placed outside the circle of the hand region, then the gesture is left
clicking. The double-clicking occurs when the thumb moves 0 to 90 degree and
back two times fast.
3. Right Clicking:
We simply implemented this part using two fingers as index finger and
middle finger. If both fingers are straight and separated by small space then
system performs right click operation. Left click and right click are performed if
count of fingers is two. But how does system differentiate between them? We
used a method in which distance between tip of fingers and angle between them is
calculated. If distance is large and angle is acute then left click is performed
otherwise right click is performed.
Figure given below shows, how numbers are recognized? As there are
three fingers straight so count is 3. In this way numbers are recognized from 0 to
5 using hand gesture recognition.
29
Controlling Computer Using Hand Gesture Recognition
A) Classification :
30
Controlling Computer Using Hand Gesture Recognition
B) Definition :
In this project wrist band of single color is used. We first detect wristband
using camera, and calculates region of interest. Wrist band helps in removing
background. Camera detects skin color and segment hand from background
image. Finally hand gesture is identified and respective operations are performed
on computer.
C) Responsibilities:
For best use of this system we must require good camera, wrist band and
user with at least a hand. Here we have defined some conventions for operations
such as left-click, right-click etc. depending on gestures recognized specific
operations are performed on computer.
System should easily capture hand images and should give quick response
to the hand gestures to perform respective operations. It should support maximum
requirements of user. It should provide better flexibility to the user. It should have
better efficiency and minimum drawbacks.
SCOE, Information Technology, 2010-11.
31
Controlling Computer Using Hand Gesture Recognition
D) Composition
32
Controlling Computer Using Hand Gesture Recognition
System
<<include>>
Valid guestures
Makes guestures
<<include>>
User
Valid operations
initiates different operations
System
Machine
Detect Hand
Identify gesture
Perform Operation
33
Controlling Computer Using Hand Gesture Recognition
User Machine
Sequence Diagram:
34
Controlling Computer Using Hand Gesture Recognition
User Machine
1 : power on cam()
2 : Cam on()
3 : Moves hand to cam()
4 : Detect Wrist Band()
6 : Detect Hand()
7 : Make gestures()
8 : Capture image()
9 : Process image()
10 : Identify Gesture()
11 : Perform operation()
sd ALt
12 : Error()
Activity Diagram:
35
Controlling Computer Using Hand Gesture Recognition
User Machine
Detect hand
processes image
Identify gesture
36
Controlling Computer Using Hand Gesture Recognition
DFD Level 0:
Mouse
Operations
K/B
Operations
Hand gestures Machine/OS
Processing
DFD Level 1:
37
Controlling Computer Using Hand Gesture Recognition
Perform Operations
User Machine
Hand Gestures
Identified Gestures
Capture
Gestures
Through
WEBCAM
Processing
CHAPTER 3
PROJECT ANALYSIS
38
Controlling Computer Using Hand Gesture Recognition
System
<<include>>
Valid guestures
Makes guestures
<<include>>
User
Valid operations
initiates different operations
System
Machine
Detect Hand
Identify gesture
Perform Operation
1. Description
Use case allows user to make gestures.
SCOE, Information Technology, 2010-11.
39
Controlling Computer Using Hand Gesture Recognition
2. Actor
User
3. Flow of event
3.1Basic flow-
3.1.1 Start the application
3.1.2 Make the gestures
3.2Alternate flow
3.2.1 Make different gesture
4. Special Requirements:
Camera is installed properly.
5. Precondition
5.1 Camera is on
5.2 Wrist band must be used.
6. Post condition
6.1 Gestures made successfully.
1. Description
Use case allows machine to detect hand.
2. Actor
40
Controlling Computer Using Hand Gesture Recognition
Machine
3. Flow of event
3.1Basic flow-
3.1.1 Switch on the camera
3.1.2 Capture gesture image
3.1.3 Detect wrist band.
3.1.4 Detect Hand.
4. Special Requirements:
Camera is installed properly.
5. Precondition
5.1 Camera is on
5.2 Wrist band must be used.
6. Post condition
6.1 Hand detected successfully.
1. Description
Use case allows machine to recognize gestures.
2. Actor
Machine
SCOE, Information Technology, 2010-11.
41
Controlling Computer Using Hand Gesture Recognition
3. Flow of event
3.1Basic flow-
3.1.1 Switch on the camera
3.1.2 Capture gesture image
3.1.3 Detect wrist band.
3.1.4 Detect Hand.
3.1.4 Identify gesture.
4. Special Requirements:
Camera is installed properly.
5. Precondition
5.1 Camera is on
5.2 Wrist band must be used.
6. Post condition
6.1 Gesture identified successfully.
1. Description
Use case allows machine to perform operations depending on gestures.
2. Actor
Machine
42
Controlling Computer Using Hand Gesture Recognition
3. Flow of event
3.1Basic flow-
3.1.1 Switch on the camera
3.1.2 Capture gesture image
3.1.3 Detect wrist band.
3.1.4 Detect Hand.
3.1.4 Identify gesture.
3.1.5 Perform operation depending on gesture.
4. Special Requirements:
Camera is installed properly.
5. Precondition
5.1 Camera is on
5.2 Wrist band must be used.
6. Post condition
6.1 Operation performed successfully depending on gesture made.
43
Controlling Computer Using Hand Gesture Recognition
User Machine
Detect hand
processes image
Identify gesture
44
Controlling Computer Using Hand Gesture Recognition
User Machine
1 : power on cam()
2 : Cam on()
3 : Moves hand to cam()
4 : Detect Wrist Band()
6 : Detect Hand()
7 : Make gestures()
8 : Capture image()
9 : Process image()
10 : Identify Gesture()
11 : Perform operation()
sd ALt
12 : Error()
CHAPTER 4
PROJECT DESIGN
45
Controlling Computer Using Hand Gesture Recognition
User Machine
DFD Level 0:
46
Controlling Computer Using Hand Gesture Recognition
Mouse
Operations
K/B
Operations
Hand gestures Machine/OS
Processing
DFD Level 1:
47
Controlling Computer Using Hand Gesture Recognition
Perform Operations
User Machine
Hand Gestures
Identified Gestures
Capture
Gestures
Through
WEBCAM
Processing
48
Controlling Computer Using Hand Gesture Recognition
Webcam
captured gestures
Computer
Hand movements
Users
CHAPTER 5
TESTING
49
Controlling Computer Using Hand Gesture Recognition
Manual Testing:-
Manual testing is the process of manually testing software for defects. It requires
a tester to play the role of an end user, and use most of all features of the application to
ensure correct behavior. To ensure completeness of testing, the tester often follows a
written test plan that leads them through a set of important test cases. It is the oldest and
most rigorous type of software testing. Manual testing requires a tester to perform manual
test operations on the test software without the help of Test automation. Manual testing is
a laborious activity that requires the tester to possess a certain set of qualities; to be
patient, observant, speculative, creative, innovative, open-minded, resourceful,
unopinionated, and skillful.
Unit Testing:-
This initial stage in testing normally carried out by the developer who wrote the
code and sometimes by a peer using the white box testing technique. The most 'micro'
scale of testing; to test particular functions or code modules. Typically it is done by the
programmer and not by testers, as it requires detailed knowledge of the internal program
design and code. Not always easily done unless the application has a well-designed
architecture with tight code; may require developing test driver modules or test harnesses.
Here in our project we have tested each module uniquely by using unit testing.
We have provided facility to recover project when error occurs.
Integration testing:-
50
Controlling Computer Using Hand Gesture Recognition
Test cases:
51
Controlling Computer Using Hand Gesture Recognition
Recognition.
Module: Wrist band detection
Form REF: Main
Test Case 1
No:
Functional Wrist band detection
Specification
Test Date: 9/04/11 1min
Test To check whether user has
Objective: put wrist band on or not.
Test Data: Wrist band
Precondition Camera should be on
Step No Steps Data Expected Results Actual
Results
1 Use hand without wrist Camera input Show message as YES,
band. put wrist band on message is
displayed
2 Use wrist band with color Camera input Show message as YES,
other than yellow. put wrist band on, message is
as wrist band other displayed
than yellow color
is not detected.
3 Use wrist band with Camera input Wrist band is YES, wrist
yellow color. detected and ROI band is
of wrist band is detected
calculated. properly.
52
Controlling Computer Using Hand Gesture Recognition
Test Case 2
No:
Functional Segmentation of hand
Specification
Test Date: 9/04/11 1min
Test To check whether hand is
Objective: segmented properly or not.
Test Data: Hand with wrist band
Precondition Camera should be on.
Step No Steps Data Expected Results Actual
Results
1 Use hand without wrist Camera input Show message as YES,
band in front of camera. put wrist band on. message is
displayed and
hand is not
segmented.
2 Use hand with wrist band Camera input Show message as YES,
with color other than put wrist band on, message is
yellow in front of camera. as wrist band other displayed and
than yellow color hand is not
is not detected. segmented.
3 Use hand with wrist band Camera input Wrist band is YES, wrist
of yellow color in front of detected and ROI band is
camera.. of hand is detected and
calculated and hand is
hand is segmented. segmented
properly.
53
Controlling Computer Using Hand Gesture Recognition
Test Case 3
No:
Functional Identification of hand
Specification
Test Date: 9/04/11 1min
Test To check whether gesture
Objective: is identified properly or
not.
Test Data: Hand gestures
Precondition 1) Camera should be
on.
2) Hand with yellow
wrist band.
Step No Steps Data Expected Results Actual
Results
1 Hand with unspecified Camera input Wait for specified Do nothing.
gestures. gestures.
2 Hand with specified Camera input Gesture is YES, gesture
gestures. identified properly. is identified
and message
is displayed
(e.g. left
click, right
click etc.)
54
Controlling Computer Using Hand Gesture Recognition
No:
Functional Implementations of
Specification operations
Test Date: 9/04/11 1min
Test To check whether
Objective: operations are performed
correctly or not.
Test Data: Hand gestures
Precondition 1) Camera should be
on.
2) Hand with yellow
wrist band.
Step No Steps Data Expected Results Actual
Results
1 Hand with unspecified Camera input Wait for specified Do nothing.
gestures. gestures and no
operations
performed.
2 Hand with specified Camera input Operations are YES,
gestures. performed operations are
depending on performed
gestures. properly.
55
Controlling Computer Using Hand Gesture Recognition
56
Controlling Computer Using Hand Gesture Recognition
Test Case 6
No:
Functional Implementations of cursor
Specification movement
Test Date: 9/04/11 1min
Test To check whether cursor
Objective: movement operation
performed correctly or not.
Test Data: Hand gestures
Precondition 1) Camera should be
on.
2) Hand with yellow
wrist band.
Step No Steps Data Expected Results Actual
Results
1 Hand with unspecified Camera input Wait for specified Do nothing.
gestures. gestures and no
operations
performed.
2 Hand with only index Camera input Cursor moves YES, cursor
finger is straight and all according to hand movement
other fingers are curled movements. takes place.
and movement of hand
takes place.
57
Controlling Computer Using Hand Gesture Recognition
CHAPTER 6
CONCLUSIONS
The goal of this project is to create a system that will recognize the hand gestures
and control Computer according to those gestures. The project will benefit the mobile
systems where using pointing devices like mouse is difficult. In this project video camera
58
Controlling Computer Using Hand Gesture Recognition
captures 25 fps. It is considered that a modern computer system would therefore allow
the project goals to be exceeded.
In future project can be used for multimedia applications like playing games
without using mouse also all keyboard operations can be performed using this project.
But enhancing this project is quite complex and difficult, so lots of hard work is required.
However, it is difficult to get stable results because of the variety of lighting and
skin colors of human races. Most vision algorithms have illumination issues. From the
results, we can expect that if the vision algorithms can work in all environments then our
system will work more efficiently. This system could be useful in presentations and to
reduce work space.
CHAPTER 7
BIBLIOGRAPHY
[1].[Bauer & Hienz, 2000] Relevant feature for video-based continuous sign language
recognition. Department of Technical Computer Science, Aachen University of
Technology, Aachen, Germany, 2000.
SCOE, Information Technology, 2010-11.
59
Controlling Computer Using Hand Gesture Recognition
[2].[Davis & Shah, 1994] Visual gesture recognition. In proceedings IEEE Visual
Image Signal Process, 1994, vol.141, No.2, pages 101-106.
[6].Zhi Li, Ray Jarvis, “Real time Hand Gesture Recognition using a Range Camera”.
60