cam.set(cv2.CAP_PROP_FRAME_HEIGHT, frame_height) while(True): ## Used for writing file to matlab #file = open('classFile.txt','a') # Capture frame by frame _, frame = cam.read() # Perform radial undistortion (Pupil world camera has significant radial distortion which adversely affects detection/classification). frame = cv2.undistort(frame, camera_matrix, dist_coefs) cv2.imshow('Object Detection',frame) # Uses neural network (darkflow) to predict detected objects and respective classifications. objects_detected = tfnet.return_predict2(frame) #print(objects_detected) # Collect normalized gaze_data, denormalize according to camera resolution (bottom-left corner is (0,0), top-right is (1,1)). gaze_data = getGazeData() gaze_x = (gaze_data['gaze_coord'][0])*frame_width gaze_y = (1-gaze_data['gaze_coord'][1])*frame_height # Y-coordinate was flipped initially # if gaze_data['confidence']>.7: # print(gazeX, gazeY, ' confidence:', gaze_data['confidence']) # Append gaze point to real-time stream as a green dot. frame = cv2.circle(frame, (int(gaze_x), int(gaze_y)), 10, (0,255,0), -1) cv2.imshow('Object Detection',frame) if objects_detected: