本文整理汇总了Python中glove.Glove.calibrate方法的典型用法代码示例。如果您正苦于以下问题:Python Glove.calibrate方法的具体用法?Python Glove.calibrate怎么用?Python Glove.calibrate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glove.Glove
的用法示例。
在下文中一共展示了Glove.calibrate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from glove import Glove [as 别名]
# 或者: from glove.Glove import calibrate [as 别名]
image = np.array(image, dtype = np.uint8)
image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
capturing = False
while True:
time_start = time.time()
image[:,:] = 0
if glove.is_calibrated():
values = glove.get_calibrated_values()
for i in range(4):
value = values[i] * height
color = [0,255,0] if value > height/2 else [0,0,255]
image[value:,100*i+48*(i+1):(i+1)*148] = color
cv2.imshow("Glove",image)
k = cv2.waitKey(10)
if k == ord('f'):
glove.calibrate(1)
fist_values = glove.cal_fist
elif k == ord('o'):
glove.calibrate(0)
open_values = glove.cal_open
elif k == ord('q'):
cv2.destroyAllWindows()
break
elif k == ord('r'):
capturing = True
print('recording')
writer = cv2.VideoWriter("videos/glove.avi",cv2.cv.CV_FOURCC(*"FMP4"),24,(640, 480))
elif k == ord('s'):
writer.release()
print('stop recording')
capturing = False