Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sei0o
Last active October 21, 2020 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sei0o/57bc5ddaca94dae7b8962675faf6aa40 to your computer and use it in GitHub Desktop.
Save sei0o/57bc5ddaca94dae7b8962675faf6aa40 to your computer and use it in GitHub Desktop.
Use EasyTello + OpenCV to obtain the video stream from Tello
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