I'm trying to use open cv with my Tello EDU drone. I eventually want to detect color but I'm having problems reading the video stream from the Tello Drone. I'm getting the message: 'OpenCV: Couldn't read video stream from file "ump://@0.0.0.0:11111". Does anyone know what might be the problem? This is the code I'm using:
from djitellopy import Tello
import cv2
import time
######################################################################
width = 320 # WIDTH OF THE IMAGE
height = 240 # HEIGHT OF THE IMAGE
startCounter = 1 # 0 FOR FIGHT 1 FOR TESTING
######################################################################
# CONNECT TO TELLO
me = Tello()
me.connect()
me.for_back_velocity = 0
me.left_right_velocity = 0
me.up_down_velocity = 0
me.yaw_velocity = 0
me.speed = 0
print(me.get_battery())
me.streamoff()
me.streamon()
while True:
# GET THE IMGAE FROM TELLO
frame_read = me.get_frame_read()
myFrame = frame_read.frame
img = cv2.resize(myFrame, (width, height))
# TO GO UP IN THE BEGINNING
if startCounter == 0:
me.takeoff()
time.sleep(8)
me.rotate_clockwise(90)
time.sleep(3)
me.move_left(35)
time.sleep(3)
me.land()
startCounter = 1
# DISPLAY IMAGE
cv2.imshow("MyResult", img)
# WAIT FOR THE 'Q' BUTTON TO STOP
if cv2.waitKey(1) & 0xFF == ord('q'):
me.land()
break
from djitellopy import Tello
import cv2
import time
######################################################################
width = 320 # WIDTH OF THE IMAGE
height = 240 # HEIGHT OF THE IMAGE
startCounter = 1 # 0 FOR FIGHT 1 FOR TESTING
######################################################################
# CONNECT TO TELLO
me = Tello()
me.connect()
me.for_back_velocity = 0
me.left_right_velocity = 0
me.up_down_velocity = 0
me.yaw_velocity = 0
me.speed = 0
print(me.get_battery())
me.streamoff()
me.streamon()
while True:
# GET THE IMGAE FROM TELLO
frame_read = me.get_frame_read()
myFrame = frame_read.frame
img = cv2.resize(myFrame, (width, height))
# TO GO UP IN THE BEGINNING
if startCounter == 0:
me.takeoff()
time.sleep(8)
me.rotate_clockwise(90)
time.sleep(3)
me.move_left(35)
time.sleep(3)
me.land()
startCounter = 1
# DISPLAY IMAGE
cv2.imshow("MyResult", img)
# WAIT FOR THE 'Q' BUTTON TO STOP
if cv2.waitKey(1) & 0xFF == ord('q'):
me.land()
break