I’ve been playing around with the blob tracking in openMV, and I Have a suggestion for improving the effective tracking resolution.
As background, people might remember the amazing performance of the WiiMote’s IR blob tracking camera. It was one of the first cheap, hackable computer vision systems and lots of projects were made based on it.
What a lot of people don’t know is that the WiiMote’s sensor was only 128x96 pixels native resolution, but by using sub-pixel averaging on the data it reported, an effective resolution of 1024x768 was obtained.
There’s a way to use the same ‘trick’ in OpenMV. In the code here:
the code tallies up the horizontal and vertical locations of each pixel in the blob, and then divides them by the number of pixels found. In particular these lines:
int mx = blob_cx / blob_pixels; // x centroid int my = blob_cy / blob_pixels; // y centroid
Because all the data types are integers, rounding error occurs. if blob_cx and blob_pixels could be converted to floats just before the division then much extra accuracy can be gained.
Here’s a simulation of the benefits of sub-pixel averaging. (Python notebook file attached if anyone wants to play with the model).
As you can see, in reasonable cases (circular targets around 36 pixels across), the effective resolution increases around 10-fold.
If you don’t want to change the API to have blob.x and blob.y returned as floats, what about including extra fields such as blob.x_float and blob.y_float?
sub-pixel centroid test v01.zip (58.1 KB)