# HAND GESTURE RECOGNITION
### INTRODUCTION
This project implements a hand recognition and hand gesture recognition system using OpenCV on Python 2.7. A histogram based approach is used to separate out a hand from the background image. Background cancellation techniques are used to obtain optimum results. The detected hand is then processed and modelled by finding contours and convex hull to recognize finger and palm positions and dimensions. Finally, a gesture object is created from the recognized pattern which is compared to a defined gesture dictionary.
**Platform:** Python 2.7
**Libraries:** OpenCV 2.4.8, Numpy
**Hardware Requirements:** Camera/Webcam
### USAGE
Run HandRecognition.py to begin the program.
**Note for Windows users:**
Remove this line from all .py files: '#!/usr/bin/python' or else you might get some error.
You will find a window that shows your camera feed. Notice a rectangular frame on the right side of the window. That's the frame where all the detection and recognition works.
To begin, keep your hand and body outside the frame, so as to capture just the background environment, and press 'b'. This will capture the background and create a model of it. This model will be used to remove background from every frame captured once the program setup is complete.
Now, you have to capture your hand histogram. Place your hand over the 9 small boxes in the frame so as to capture the maximum range of shades of your hand. Don't let any shadow or air gap show on the boxed areas for best results. Press 'c' to capture the hand and generate a histogram.
The setup is now complete. Now you will see, by keeping your hand inside the rectangular frame, it gets detected and you will notice a circle inside your palm area, with lines projecting out from it towards your fingers. Try moving your hands, hiding a few fingers or giving it one of the sample gestures implemented in the program.
The sample gestures implemented are described with screenshots in the documentation.
They are:
1. "V" with your index and middle finger
2. A flipped "L" with thumb and index finger
3. Pointing with your index finger in vertical position
**Note:** Press 'q' at any time to stop the program or 'r' to restart the program.
### HOW DOES IT WORK?
Read full documentation for detailed explanation about implementation in "docs" folder.
During setup, first a background model is generated when the user presses 'b'. Then, a histogram is generated when the user provides his hand as a sample by pressing 'c'. When the setup is completed, the program goes into an infinite while loop which does as follows.
Camera input frame is saved to a numpy array. A mask is generated based on background model and applied on the frame. This removes background from the captured frame. Now the frame containing only the foreground is converted to HSV color space, followed by histogram comparison (generating back projection). This leaves us with the detected hand. Morphology and smoothening is applied to get a proper hand shape out of the frame. A threshold converts this into a binary image.
Next, we find contours of the binary image obtained, look for the largest contour and find its convex hull.
Using points from the largest contour we determine center of the palm by finding the largest circle inscribed inside the contour and then the dimension of palm. Using the center of palm as reference, we eliminate all points from the convex hull which do not seem to be part of hand. Also, nearby convex hull points are eliminated so that we are left with exactly only those many points as the number of fingers stretched out.
Using the positions of fingers and palm dimensions, we model our hand.
Then we compare the model with a dictionary of Gestures defined in GestureAPI.py to determine presence of gestures.
**Full explanation with screenshots is provided in /docs/Documentation.pdf**
For any queries, contact: mahaveer.verma1@gmail.com
没有合适的资源?快使用搜索试试~ 我知道了~
OpenCV+python手势识别框架和简单例子
共22个文件
jpg:9个
xml:4个
py:2个
5星 · 超过95%的资源 需积分: 18 93 下载量 198 浏览量
2019-04-15
16:01:20
上传
评论 13
收藏 1.7MB ZIP 举报
温馨提示
OpenCV+python手势识别框架和简单例子 基于 静默虚空 大神文章的原码修改调通的。https://blog.csdn.net/linsk/article/details/76457955
资源推荐
资源详情
资源评论
收起资源包目录
hand-gesture-recognition-opencv-master.zip (22个子文件)
hand-gesture-recognition-opencv-master
.DS_Store 6KB
GestureAPI.py 3KB
.idea
misc.xml 288B
workspace.xml 13KB
encodings.xml 135B
hand-gesture-recognition-opencv-master.iml 398B
modules.xml 328B
LICENSE 1KB
GestureAPI.pyc 4KB
README.md 4KB
__pycache__
GestureAPI.cpython-37.pyc 3KB
screenshots
2.jpg 49KB
8.jpg 178KB
6.jpg 43KB
1.jpg 175KB
4.jpg 171KB
5.jpg 109KB
9.jpg 175KB
7.jpg 178KB
3.jpg 194KB
docs
Documentation.pdf 656KB
HandRecognition.py 11KB
共 22 条
- 1
资源评论
- asurme2021-08-16请问这个用什么软件打开
bingoshy
- 粉丝: 3
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功