Ideal object for recognition with OpenCV

I have an application where I want to track 2 objects at a time, which are pretty small in the shot. This application must work on Android and iPhone, so the algorithm must be efficient.

For a client of mine, it's great if we deliver some templates along with software that attaches to objects that need to be tracked in order to have a well-recognized target.

This means that I can compose the sample myself. Since I'm not very good at image processing yet, I don't know which objects are easiest to recognize in a picture, even if they are quite small. Color is also possible, although processing multiple planes separately is not required due to the generated overhead.

Thanks for any advice !! Best,

guitarflow

+3


source to share


2 answers


If I get it straight, your object should:

  • Can be printed on A4
  • Be recognizable up to 4 meters
  • Rotational invariance is not that important (I am making an assumption that the user will hold the phone +/- vertically)

I recommend printing a large board and using a combination of color matching and angle definition. Try different combinations to see which is faster and more reliable at difference distances.

Color: If you only want to work on one channel, you can print in red / green / blue * and then only work on that corresponding channel. This will already filter a lot and increase the contrast "for free". Otherwise the histogram acceleration will be very fast. See here .

Also, let's say you only have 4 squares with RGB + black (see image), it would be easy to get all the red outlines and then check if it has the correct adjacent colors: a blue patch on the right and a green patch under it , both are in roughly the same area. This in itself can be quite robust and is equivalent to working on 1 channel, as for each step you only get access to one specific channel (search for contours in red, check on the right in blue, check below in green).



RGB squares

If you are getting a lot of false positives, you can use angles to filter your hits. In the example image, you already have 9 corners, in fact even more if you separate the channels, and if that's not enough, you can make a true checkerboard with several squares to have more corners. It will probably be enough to check how many angles are detected in the ROI to reject false positives, otherwise you can also check that the distance between the detected angles in the x and y directions is uniform (i.e., generate a mesh).

Corners: Corners are detected and there are several methods here. I don't know how effective each of them are, but they are fast enough that after you have reduced the ROI based on color, this shouldn't be a problem. Perhaps the simplest is to simply undermine / develop the cross to find the corners. See here . You must first create an image threshold to generate a binary map, possibly based on color as above. Other corner detectors, such as the Harris detector, are well documented .

Oh, and I don't recommend using Haar classifiers. Seems overly complicated and not very fast (albeit very robust for complex objects: i.e. if you can't use your own template), not to mention a huge amount of work to learn.

+5


source


Haar training is your friend.

In this tutorial, you should get started: http://note.sonots.com/SciSoftware/haartraining.html



Basically you train something called a classifier based on exemplary images (2000 or so of the object you want to track). OpenCV already has the tools needed to create these classifiers and functions in the object detection library.

+1


source







All Articles