3

The Tello sdk has the streamon and streamoff commands. These start and end the 720p video stream. Is there a way to get a 5 megapixel image through the sdk, like when you put the control app into photo mode? I'm guessing if such a way exists, it is not documented.

Darth Egregious
  • 18,184
  • 3
  • 32
  • 54

1 Answers1

0

while there isn't a UDP command that you can send to the drone to switch, there is some python code that you could try in order to make it work. and to make something like that work easily without coding it over again putting it in a function and calling it like "takePhoto()" is the best solution I have. Here's some code:

# # simple ex_4: Tello_photo
# <\>

from djitellopy import tello
import cv2

me = tello.Tello()
me.connect()
print(me.get_battery())


def TakePhoto(me):
    me.streamoff()
    me.streamon()
    img = me.get_frame_read().frame
    # print(img)
    # img = cv2.resize(img, (360, 240)) # optional
    cv2.imshow("photo", img)  # optional display photo
    cv2.waitKey(0)

# # example condition, it can also just be called normally like "TakePhoto"

"""
if (1 + 1) == 2:
    TakePhoto(me)
"""

# # another example, with an actual used if statement

"""
bat = me.get_battery()

if bat < 50:
    TakePhoto(me)
else:
    print("battery too low (for ex)")
"""

# # for now, we'll call it just like this for testing:

TakePhoto(me)

# </>

the code was tested on windows 10 - pycharm 2021.2 > python3.x >> opencv 4.5.1.48

I hope this helped and I hope it works for you.

Keshav.h
  • 35
  • 9