Im building a DIY laser target.
So far on the software side I managed to find when is a laser shot at the target by calculating differences and threshold, and then find where did it hit in relation to the whole image.
Now the next problem I am facing is finding where it hit in relation to the target center.
I have a proper box assembled for the target, but while testing this is what I have (the inner circle should have been filled with black):
Its not pretty and has lots of unrelated noise but it should be enough to test. This is a best possible scenario, from within the box:
To find where it hit in relation to the target center I suppose I'll have to make a binary image out of those two black rings and calculate the average point. (how?)
Then (supposing the target is perfectly parallel, not even a little bit in perspective), with the center known, I would need to know how far the outer ring is from it.
With that known it should be a matter of trigonometry to tell the punctuation (11 to 0, being 0 the outside of the outer ring)
Resuming the question:
- Need to detect a known figure(ring), tell where its center is, and determine its radius.
I am not worried about performance since this will only be done once at each program run to calibrate.
Some sample C++ code (besides pointing to the functions I can use) would be great since I'm new to both C++ and OpenCV.