def receive():
'''
1. Locate screen
2. Follow the variations of intensity in the screen
'''
sampling_period = 1/SAMPLING_FREQUENCY
f = open(EXCHANGE_FILE_PATH, 'w')
f.write('')
x,y,w,h = screen_position()
if((x,y,w,h) == (-1,-1,-1,-1)):
print("Unable to detect screen")
return
cap = cv2.VideoCapture(0)
values = []
try:
while(True):
ret, frame = cap.read()
sub_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)[y:y+h, x:x+w]
values.append(str(np.mean(sub_frame)))
except KeyboardInterrupt:
pass
f.write('\n'.join(values))
f.close()
decode()
评论列表
文章目录