本文整理匯總了Python中glove.Glove.is_calibrated方法的典型用法代碼示例。如果您正苦於以下問題:Python Glove.is_calibrated方法的具體用法?Python Glove.is_calibrated怎麽用?Python Glove.is_calibrated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類glove.Glove
的用法示例。
在下文中一共展示了Glove.is_calibrated方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Glove
# 需要導入模塊: from glove import Glove [as 別名]
# 或者: from glove.Glove import is_calibrated [as 別名]
ARDUINO_PORT = "/dev/ttyACM0"
allocated_time = 1./24
cv2.namedWindow("Glove")
glove = Glove(ARDUINO_PORT, 9600)
fistValues = []
openValues = []
height = 480
image = np.zeros((height,640))
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()