资源简介
hand-gesture-recognition-opencv-master.zip

代码片段和文件信息
#!/usr/bin/python
import math
import numpy as np
class Gesture(object):
def __init__(selfname):
self.name=name
def getName(self):
return self.name
def set_palm(selfhand_centerhand_radius):
self.hand_center=hand_center
self.hand_radius=hand_radius
def set_finger_pos(selffinger_pos):
self.finger_pos=finger_pos
self.finger_count=len(finger_pos)
def calc_angles(self):
self.angle=np.zeros(self.finger_countdtype=int)
for i in range(self.finger_count):
y = self.finger_pos[i][1]
x = self.finger_pos[i][0]
self.angle[i]=abs(math.atan2((self.hand_center[1]-y)(x-self.hand_center[0]))*180/math.pi)
def DefineGestures():
dict={}
# 1. BEGIN ------------------------------------#
V=Gesture(“V“)
V.set_palm((475225)45)
V.set_finger_pos([(49090)(415105)])
V.calc_angles()
dict[V.getName()]=V
# 1. END --------------------------------------#
# 2. BEGIN ------------------------------------#
L_right=Gesture(“L_right“)
L_right.set_palm((475225)50)
L_right.set_finger_pos([(45062)(345200)])
L_right.calc_angles()
dict[L_right.getName()]=L_right
# 2. END --------------------------------------#
# 3. BEGIN ------------------------------------#
Index_Pointing=Gesture(“Index_Pointing“)
Index_Pointing.set_palm((480230)43)
Index_Pointing.set_finger_pos([(475102)])
Index_Pointing.calc_angles()
dict[Index_Pointing.getName()]=Index_Pointing
# 3. END --------------------------------------#
return dict
def CompareGestures(src1src2):
if(src1.finger_count==src2.finger_count):
if(src1.finger_count==1):
angle_diff=src1.angle[0]-src2.angle[0]
if(angle_diff>20):
result=0
else:
len1 = np.sqrt((src1.finger_pos[0][0]- src1.hand_center[0])**2 + (src1.finger_pos[0][1] - src1.hand_center[1])**2)
len2 = np.sqrt((src2.finger_pos[0][0]- src2.hand_center[0])**2 + (src2.finger_pos[0][1] - src2.hand_center[1])**2)
length_diff=len1/len2
radius_diff=src1.hand_radius/src2.hand_radius
length_score=abs(length_diff-radius_diff)
if(length_score<0.09):
result=src2.getName()
else:
result=0
else:
angle_diff=[]
for i in range(src1.finger_count):
angle_diff.append(src1.angle[i]-src2.angle[i])
angle_score=max(angle_diff)-min(angle_diff)
if(angle_score<15):
length_diff=[]
for i in range(src1.finger_count):
len1 = np.sqrt((src1.finger_pos[i][0]- src1.hand_center[0])**2 + (src1.finger_pos[i][1] - src1.hand_center[1])**2)
len2 = np.sqrt((src2.finger_pos[i][0]- src2.hand_center[0])**2 + (src2.finger_pos[i][1] - src2.hand_center[1])**2)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-07-02 16:04 hand-gesture-recognition-opencv-master\
文件 3579 2016-07-02 16:04 hand-gesture-recognition-opencv-master\GestureAPI.py
文件 3922 2016-07-02 16:04 hand-gesture-recognition-opencv-master\GestureAPI.pyc
文件 9507 2016-07-02 16:04 hand-gesture-recognition-opencv-master\HandRecognition.py
文件 1081 2016-07-02 16:04 hand-gesture-recognition-opencv-master\LICENSE
文件 3972 2016-07-02 16:04 hand-gesture-recognition-opencv-master\README.md
目录 0 2016-07-02 16:04 hand-gesture-recognition-opencv-master\docs\
文件 672031 2016-07-02 16:04 hand-gesture-recognition-opencv-master\docs\Documentation.pdf
目录 0 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\
文件 179617 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\1.jpg
文件 50359 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\2.jpg
文件 198452 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\3.jpg
文件 174660 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\4.jpg
文件 111111 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\5.jpg
文件 44299 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\6.jpg
文件 182413 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\7.jpg
文件 182529 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\8.jpg
文件 179163 2016-07-02 16:04 hand-gesture-recognition-opencv-master\screenshots\9.jpg
相关资源
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
评论
共有 条评论