Method for tracking Color Blob and April Tag


I am working on new project for my QuadCopter : Precision Landing , and I am trying to mix 2 tracking scripts + Color Tracking and April Tag tracking.

Color Tracking works OK if you can really tune the filter for the correct lighting and surrounding, best is still a red patch on a grass field :wink:
April Tag is quite precise for short range but with low resolution (QQVGA) its missing range.

Here is a demo with OpenMV: Precision Loiter & Landing with OpenMV on APril Tags Pad - YouTube

So my idea is to build a compound landing pad : 1 Meter Square Red Sheet with a 30cmx30cm April Tag in the center.

The quadcopter would initiate precision landing based on the color and then it would switch to April Tag.

Considering that we might not enough memory to get both process simultaneously, is there a method to switch from Color to Tag when the blob is bigger than “N” pixels ?


There’s enough memory to do both at once. AprilTag only uses RAM when it’s being called. After the function executes it frees up the RAM. I think you’re concerned about having to use two different resolutions.

Anyway, if you’d like to just switch with AprilTags you can put progressively smaller AprilTag’s inside of each other. I.e. Have one big one that has a smaller one inside of it.

If you want to continue with color tracking and AprilTags at the same time you can just call the AprilTag function on an ROI int the center of a color blob. As long as the ROI is about 160x120 pixels then the AprilTag function will not run out of RAM.

Finally, you can change the camera resolution at will. However, this will result in about 2-3 frames being dropped.

Cool, as you can see I attached the picture of my prototype (BTW I f you look carefully at the video, there are 4 Tags of different sizes and the quad finished on the small one).

OK I will try to work on a simpler example then: Lets call it white square on a red patch.
If I follow you, I am setting my first filter to red and then we can select a ROI, corresponding to the white blob once we are close enough.
What would be the logic for switching from red to white filter ?
And then how can we extract this new ROI an pass it over to the Tag detection ?

Or if you have any suggestion on the method/strategy :wink:

Thanks kwagyeman

All the methods (the one’s I’ve re-written atleast), have an ROI keyword argument to set the region of interest (x,y,w,h) to work on. Memory is only allocated for that ROI size. So as long as the ROI is less than 160x120 pixels you’re fine. That said, scaling can be an issue… but, other than that it’s fine. See the doc.

apriltag_roi = ( - 80, - 60, 160, 120)

find_apriltags(roi = apriltag_roi, …)

LOL , sorry, for the delay, You are answering faster than I write :laughing: