Video length is 2:14

Control Ryze Tello Drones from MATLAB

This video introduces MATLAB® Support Package for Ryze Tello Drones and demonstrates a drone used as a mobile person counter that launches and takes photographs at it rotates. Learn how to use Image Processing Toolbox™ to count face-like features in the images and total up the number of faces found. The video explains the MATLAB code used to make the person counter including takeoff, rotating, flipping, and landing.

Published: 23 Jul 2020

Starting in Release 2020a, you can control a Ryze Tello drone from MATLAB!  While the mobile app that comes with the drone allows you to fly the drone and do flips, MATLAB enables you to augment the capabilities of your drone, like being able to operate as a mobile person counter.

This video clip demonstrates a flight where the drone searches for and counts faces.  First, the drone takes off, then increases its altitude to be suitable for taking pictures of faces. For each picture,  it rotates a little, takes a picture, and counts the number of faces in the picture. When it’s done, it does a flip to celebrate, and then lands.

To do this with your own drone, start the flight by connecting your computer to the drone via WiFi.  Press the power button on the drone, and then have your computer scan for new WiFi networks. Find your drone, and connect.

Here you can see the MATLAB view.  There is a preview on the right of what the drone’s camera sees during its flight. After each image is processed, the picture is placed in a montage in this figure, with any faces detected by the drone surrounded by a red box.

In this case, the same face showed up in three pictures, so the drone counted 3 faces total, as indicated in the title of the montage after the flight completes.

This script controls the actions of the drone during the flight.  You can set the total rotation angle and the number of pictures to take.  The main drone object is created with the “ryze” function, and the “camera” function starts the front view camera. Use “preview” to see in real-time what the camera sees. These lines of code help to rearrange the windows so they can all be seen at once.

Image Processing Toolbox provides a built-in face detector called CascadeObjectDetector, which can locate anything in an image that looks like a face.

Use “takeoff” to get the drone in the air and “moveup” to increase the altitude.

The face count routine runs in this loop. It updates the montage with the photos of any detected faces.

Finally, this code flips the drone in the forward direction, followed by landing the drone, and updating the figure containing the face count.

MATLAB makes it quick and easy to use and augment the capabilities of your drone. You can explore even more flight control and flight recording options in the documentation. Happy tracking!

Related Products