Trouble detecting circles with 4K camera

Post Reply
liteyear
Posts: 13
Joined: Fri Jun 02, 2023 7:01 am

Trouble detecting circles with 4K camera

Post by liteyear »

I had a really successful build and went through calibration smoothly. But I hit a brick wall when it came to detecting circles with the down facing camera. My experience is probably best conveyed by this third party scene:

https://youtu.be/uUfGu2sId9w?t=288

Essentially there is so much detail in the image that the vision algorithms refuse to acknowledge a bumpy circle. As a newbie this was maddening - I didn't have any experience of successful detection, so didn't even know what I was missing. I didn't know what a good circle was, nor what the algorithm was finding or not finding.

In the end I realised the algorithm was thrown off by the jagged edge and incomplete centre. Unbeknownst to me at first, this was especially problematic with the dot I made with a marker for the homing mark, and with the "Hello World" fiducials made with my ink jet printer, since they have fine non-ideal detail. But it is a challenge with any real world circle too.

Adjusting the algorithm was a exercise in futility. Blurs don't seem to do anything regardless of their parameters (is pixel density too high?) and several of the functions just make the software unresponsive.

Finally, I discovered a trick! I de-focused the camera a little and boom - all the detail vanished and circles starting popping up everywhere. Here for example, is the focus blur helping create a circle from the imperfect ink-jet produced circle:
Screenshot 2023-06-22 at 11.41.39 am.png
Screenshot 2023-06-22 at 11.41.39 am.png (395.9 KiB) Viewed 24193 times
So my theory is that the software is not well suited to the newer high resolution cameras. Is that possible? In that case, am I better off configuring the camera feed at a lower resolution (and restarting all my meticulous calibration), or is there another trick to make the algorithm happy? I'd like to stick with the LitePlacer software if I can get away with it.

Another point that may be related - the down facing LEDs seem really dim through the diffuser. As you can see in the screenshot, putting the camera over a white sheet of paper gives a murky grey (175, 194, 227) according to the colour picker. I think this is severally limiting the contrast available, but perhaps this is a net benefit? Is the diffuser too thick? I'm running my LEDs off 12V from the TinyG.
Screenshot 2023-06-22 at 11.34.30 am.png
Screenshot 2023-06-22 at 11.34.30 am.png (512.46 KiB) Viewed 24193 times
Post Reply