Last active
October 16, 2023 12:20
-
-
Save f41ardu/b75da46dae383e5c835295600deef604 to your computer and use it in GitHub Desktop.
Raspberry, python3.7, opencv and 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
# | |
# --- (c) 01/2020 f41ardu | |
# | |
# Tello cam using opencv proof of concept | |
# issue: huge delay -> Tipp scale down video size for improved performance on Raspberry PI 3+ | |
# May also work with older versions of opencv supporting incomming udp streams. | |
# | |
#import numpy as np | |
# import opencv 4.2.0 | |
import cv2 | |
import time | |
telloVideo = cv2.VideoCapture("udp://@0.0.0.0:11111") | |
#telloVideo.set(cv2.CAP_PROP_FPS, 3) | |
# wait for frame | |
ret = False | |
# scale down | |
scale = 3 | |
while(True): | |
# Capture frame-by-framestreamon | |
ret, frame = telloVideo.read() | |
if(ret): | |
# Our operations on the frame come here | |
height , width , layers = frame.shape | |
new_h=int(height/scale) | |
new_w=int(width/scale) | |
resize = cv2.resize(frame, (new_w, new_h)) # <- resize for improved performance | |
# Display the resulting frame | |
cv2.imshow('Tello',resize) | |
if cv2.waitKey(1) & 0xFF == ord('q'): | |
break | |
# When everything done, release the capture | |
telloVideo.release() | |
cv2.destroyAllWindows() |
when I use this , should i change ip and port?
Feel free to use the local IP address and port. 0.0.0.0 is seamless, use the locak adress of your system.
Thank you! Referring to your code, I modified the official example to the version of Python 3
how can i remove the latency i have 1 seconds of latency
Thank you so much! I managed to transfer the Tello project to Python 3 using your script!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Improved version!