Object tracking with openCV on pix-hawk or apm+raspberry pi

1,513 views
Skip to first unread message

soms...@gmail.com

unread,
Jul 26, 2016, 9:01:30 AM7/26/16
to drones-discuss
Hi ,every body. i want to build a quad-rotor to tracking object like cat or dog, i buy raspberry and i know that must work on opencv.
also i want to control my copter in mission planner and see behavior on it. in addition i want see my cats in HUD of mission-planner with video stream like as analog video transmitter(and convert to usb ) and then select one cat to copter track and follow it. in more of sites people work with WiFi but i want use 3DR telemetry to have long range!!!
Now how can i click and select my cat in mission planner(hud) to run opencv program on raspberry pi to sent command(like mavlinke ) to pix-hawk that track my cat and follow it.I emphasize that i want use telemetry(like 3DR) not use wifi or other.
Thank you for all.

Needtobea sleep

unread,
Aug 15, 2016, 4:30:00 AM8/15/16
to drones-discuss
Hey smos,
i have tried the same with the same Setup. I used a Raspberry pi2 with a raspicam. Unfortunately I didn't get it to work yet. I tried the Cam and mean shift Tracker from opencv. I recommend to use meanshift. The Tracking was fine sometime. However very often the Tracker jumped away, depending on the object you want to track. Meanshift is using colors to track. So a dog or a cat would be a Challenge. There are also haarcascades for Dogs and cats, but the are slow and you can then only track cats and dogs.
So I looked for different methods... I found the opentld Tracker. Unfortunately the Tracker was way too slow with 2-3fps olnly.
I also tried the dlib Tracker. I used Python with opencv and the dlib libary installed. The Tracker is very easy to setup and works almost fine with about 6 fps. Enough to follow a movement. But the Tracker has the Problem that it doesn't recognize if the object is out of the camera View. And if the tracker get lost once it won't come back. I also tried cmt but the frame rate was very bad with 1-2fps.

The most important trackers are opentld and dlibs Tracker. I searches about how I can improve the fps and found some thing called GPU accelerated processing for the Raspberry Pi. However there it gets way to complicated for me. And there is also nobody who did that yet.

I'm interested how you want to select the object you want to track. I have two solutions for that. If you are interested then write to me.
So after 4 month of work I Stil didn't get a working solution.

I want to try to use an Android Smartphone instead of a Raspberry pi. A possibility would be to mount the front facing camera on the gimbal. There is also a opentld implementation for Android. And you have already a very light weight battery. The communication with the pixhawk would work using the USB. Maybe you need a an Arduino for that too.

If you need help with any othe things above or the installation contact me. I can also share the code with you if you need it.

Good luck! :D

Wil Selby

unread,
Aug 16, 2016, 10:40:53 PM8/16/16
to drones-discuss
Smos,

I did something similar for tracking whales in the ocean. We used footage of whales to develop the computer vision algorithms but ultimately tested it indoors with a whale video projection, tracking a roomba, and outdoors tracking a wagon.

Check out my write up here for more info:
http://www.wilselby.com/sample-page/research/mit-masters-thesis/

The thesis includes all the context and the videos show multiple versions of the experiments we conducted. Note that I didn't use ArduCopter at the time but the theory and principles would still apply.

-Wil
Reply all
Reply to author
Forward
0 new messages