15 drone.wait_for_connection(60.0)
19 while container
is None and 0 < retry:
22 container = av.open(drone.get_video_stream())
23 except av.AVError
as ave:
30 for frame
in container.decode(video=0):
32 frame_skip = frame_skip - 1
34 start_time = time.time()
35 image = cv2.cvtColor(numpy.array(frame.to_image()), cv2.COLOR_RGB2BGR)
36 cv2.imshow(
'Original', image)
37 cv2.imshow(
'Canny', cv2.Canny(image, 100, 200))
39 if frame.time_base < 1.0/60:
42 time_base = frame.time_base
43 frame_skip = int((time.time() - start_time)/time_base)
46 except Exception
as ex:
47 exc_type, exc_value, exc_traceback = sys.exc_info()
48 traceback.print_exception(exc_type, exc_value, exc_traceback)
52 cv2.destroyAllWindows()
54 if __name__ ==
'__main__':