Last active
October 21, 2020 00:06
-
-
Save sei0o/57bc5ddaca94dae7b8962675faf6aa40 to your computer and use it in GitHub Desktop.
Use EasyTello + OpenCV to obtain the video stream from Tello
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from easytello import tello | |
import time | |
import cv2 | |
# see: https://stackoveflow.com/questions/50916903 | |
d = tello.Tello() | |
d.takeoff() | |
d.streamon() | |
time.sleep(3) # you might not need this | |
cap = cv2.VideoCapture('udp://0.0.0.0:11111') | |
if not cap.isOpened(): | |
print("Failed to open VideoCapture, stopping.") | |
exit(-1) | |
while True: | |
ret, frame = cap.read() | |
if not ret: | |
print('empty frame') | |
break | |
cv2.imshow('image', frame) | |
if cv2.waitKey(1) & 0xFF == ord('q'): # push Q to close | |
break | |
d.land() | |
d.streamoff() | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment