damiafuentes / DJITelloPy

DJI Tello drone python interface using the official Tello SDK. Feel free to contribute!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CV2 stream does not load properly in developer mode

Isabella-L opened this issue · comments

I am running a simple program to test video streaming with tello drone.
When I follow the instruction to clone and install for developer mode, the cv2.imshow() function is not working properly.

On Windows 10 the stream shows up incorrectly, with the R value replaced by B. Everything red shows up as blue.
On Ubuntu 20.04 the program stuck at cv2.imshow() and the cv2 window stream never shows up at all.

The console output is:

non-existing PPS 0 referenced
non-existing PPS 0 referenced
decode_slice_header error
no frame!
left block unavailable for requested intra4x4 mode -1
error while decoding MB 0 5, bytestream 11800

However, if I use pip install djitellopy then everything works just fine.
There will be a cv2 window prompt with the live stream and the console looks like this:
image
Don't be alarmed by the red lines it doesn't affect the program running. The video stream is working properly.

I am not an expert in H264 decoding. I hope someone can help me understand what is happening here.

My code is very simple:

from djitellopy import Tello
import cv2

me = Tello()

me.connect()
print(me.get_battery())
me.streamon()
frame_reader = me.get_frame_read()

while True:
    cv2.imshow("Tello Stream", frame_reader.frame)
    c = cv2.waitKey(1) 
    if c == 27: #ESC
        break

me.end()
cv2.destroyAllWindows()