importcv2importnumpyasnp# Workaround for https://github.com/opencv/opencv/issues/21952cv2.imshow("cv/av bug",np.zeros(1))cv2.destroyAllWindows()frompupil_labs.realtime_api.simpleimportdiscover_one_device# noqa: E402defmain():# Look for devices. Returns as soon as it has found the first device.print("Looking for the next best device...")device=discover_one_device(max_search_duration_seconds=10)ifdeviceisNone:print("No device found.")raiseSystemExit(-1)print(f"Connecting to {device}...")try:whileTrue:bgr_pixels,frame_datetime=device.receive_eyes_video_frame()draw_time(bgr_pixels,frame_datetime)cv2.imshow("Eyes Camera - Press ESC to quit",bgr_pixels)ifcv2.waitKey(1)&0xFF==27:breakexceptKeyboardInterrupt:passfinally:print("Stopping...")device.close()# explicitly stop auto-updatedefdraw_time(frame,time):frame_txt_font_name=cv2.FONT_HERSHEY_SIMPLEXframe_txt_font_scale=1.0frame_txt_thickness=1# first line: frame indexframe_txt=str(time)cv2.putText(frame,frame_txt,(20,50),frame_txt_font_name,frame_txt_font_scale,(255,255,255),thickness=frame_txt_thickness,lineType=cv2.LINE_8,)if__name__=="__main__":main()