Introduction: How to Do Object Tracking With Raspberry Pi and Your Drone
Object Tracking is one of the most important aspects of computer vision. It has a wide range of applications, most important of which is information extraction. It can be helpful in the fields of surveillance, traffic monitoring, video annotations, transportation, and robotics.
Drones offer a different perspective on the way we look at things. As a result, they are an excellent medium to carry out object tracking. In this article, we will implement Object tracking using Raspberry Pi3. It is one of the best DIY companion computers in the market and is well suited to carry out computer vision applications.
For the purpose of this project, I am using FlytOS - the drone operating system offered by FlytBase. FlytBase provides users with a ready-to-use Visual follow me app. So, without any further delay, let's begin.
Step 1: Setup Your FlytBase Account
The first thing you do is setup a FlytBase account. It's free and takes less than a minute.
FlytBase offers FlytOS, an operating system for developing intelligent drone applications.
We will use FlytOS to achieve object tracking with Raspberry Pi3.
Step 2: Install and Setup FlytOS
Log in to your My FlytBase account, you will see an option to download FlytOS. FlytOS supports multiple companion computers. Keep in mind that we are using Raspberry Pi for this project. Follow this guide to installing FlytOS on Raspberry Pi. Be sure to follow the recommended method so you don't get any errors.
Step 3: Setting Up Your Drone
Once the FlytOS is successfully installed, you need to ready your drone for first flight and setup some calibrations.
Now, mount your camera on the drone, make sure the camera is facing downwards so that it is in a position to track the object. Also, do not forget to configure the flight modes and the offboard switch.
Once the drone setup is done, you are ready for the static test.
Step 4: Static Test
Power on your drone and connect it to Wi-Fi. Before we go on a flight test, we must do a static test to make sure everything works fine.
Visual Follow Me is an onboard web app that comes bundled with FlytOS (placed in /flyt/flytapps/web/flytfollowme). This app talks to the onboard Object Tracking module using its FlytAPIs. We are gonna implement color object tracking. To open this app, connect to your Rpi board from a browser and go to URL
In the following window, click on Start button. You will see a video feed where your tracking will be displayed and some options for setting up parameters. Place the object you want to track in front of your camera and select on the video feed screen. Once the camera recognizes the object, click 'Start Tracking' and move the object around. You should see the camera border moving along with the object. The app also gives us the option to set parameters like Hue, Saturation, and value for better Image recognition.
Step 5: Flight Test
If you have followed the instructions so far, you should be ready for Flight test. Before flying the drone be sure to read the safety guidelines and essentials for a safe flight. Connect to your Raspberry Pi from the browser and go to URL <ip>/followme.
Take off your drone to about 5 meters and switch to offboard mode.
Click the Start button and place the object you want to track right beneath the camera frame. Select the object from the video feed. Once the object is recognized, setup other parameters like hue, saturation, and values if needed. Set the drone velocity for smooth tracking. Once you are happy with the setup, go to the Follow section and click on Follow button. Now, your drone will start following the object.
Good luck and happy tracking!