资源简介
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
相关资源
- SuperVideoSplitter(视频分割软件)v5.4免
- GOF设计模式.pdf
- jiandie.zip
- u010724960_10692097.zip
- skin全编程.zip
- 风云办公器.zip
- 超声成像算法导论_12093865.pdz
- 山东大学操作系统课设实验报告.zip
- 图像恢复GUI.zip
- pdf2word.exe
- biaobiaobiaobiao思考注释.zip
- 归档.zip
- CPrimerPlus中文第六版高清.epub
- qing_lgq_6764265.zip
- 2018全网免VIP看视频源码.rar
- PRML中文版.rar
- apache-tomcat-7.0.57.zip
- nicholasyong_3150597.zip
- GBT19710-2005地理信息元数据(全部)
- muziyu2015_10014594.zip
- 机器人状态估计中英文合集.rar
- PanDownload_v2.0.5.zip
- CopperCAM2019汉化版.rar
- 凸优化.zip
- UART.rar
- zw_softmax_exercise.zip
- zw_深圳shp.zip
- 人工智能在计算机网络中的应用.pdf
- 单多基地有源无源定位技术.pdf
- 鸟哥的Linux私房菜-基础学习篇(第四
评论
共有 条评论