import cv2 from bebop import Bebop cnt = 0 f = open( "./images/video.h264", "wb" ) def videoCallback( frame, drone, debug=False ): global cnt if isinstance(frame, tuple): print("h.264 frame - (frame# = %s, iframe = %s, size = %s)" % (frame[0], frame[1], len(frame[2]))) f.write(frame[-1]) f.flush() else: cnt = cnt + 1 cv2.imshow("image", frame) cv2.waitKey(10) print("Connecting to drone..") drone = Bebop( metalog=None, onlyIFrames=False, jpegStream=True ) drone.videoCbk = videoCallback drone.videoEnable() print("Connected.") for i in xrange(10000): drone.update()
def video2stdout(): drone = Bebop( metalog=None, onlyIFrames=False ) drone.videoCbk = videoCallback drone.videoEnable() while True: drone.update()
cv2.destroyWindow("Drone") # Have to send waitKey several times on Unix to make window disappear for i in range(1, 5): cv2.waitKey(1) matcher = Matcher([("fau-logo", "../opencv/templates/fau-logo.png"), ("first-logo", "../opencv/templates/first-logo.jpg"), ("nextera-logo", "../opencv/templates/nextera-energy-logo.jpg"), ("techgarage-logo", "../opencv/templates/techgarage-logo.png") ], min_keypoints_pct_match=10) print("Connecting to drone..") drone = Bebop() drone.video_callbacks(video_start, video_end, video_frame) drone.videoEnable() print("Connected.") for i in xrange(10000): if command is None: drone.update( ); elif command == "TAKEOFF": print("Taking offf.........................") drone.takeoff() command = None elif command == "LAND": print("Landing ...........................") drone.land() command = None
def video2stdout(): drone = Bebop(metalog=None, onlyIFrames=False) drone.videoCbk = videoCallback drone.videoEnable() while True: drone.update()