I want to detect a dark spot in an circle create on a light background, and convert it to an number (degrees).
to make it more clear, I sketched something in paint(see attached picture). I want to do it with vision. What kind of feature do I need to make this possible?
Solved! Go to Solution.
put the dark spot in three different positions and fit a circle to the points (or better yet, use more positions and fit the circle using least squares). When you have the center of the circle, you can use it to fit a line between circle center and the center of the dark spot (detect the dark spot with thresholding, if the contrast is good or you could use pattern matching, etc... - depends on your setup).
Using the line, you can calculate the slope. Be careful that your system setup does not change, or you need to perform the "calibration" again.
the simplest way is to use IMAQ Fit Circle.
Of course, every specific application requires some extent of coding.
How can you get the radial points? do you have to set them in the picture by clicking or something?
See attached image, this is an example picture after thresholding to read this position, the output number will be in this case a bit more then 270°
you need at least three points to form a circle, sou you need to detect the centers of your dark spot at three different positions on the circle perimeter (while the camera remains still). Each center has a (u,v) location in the image (in pixels) - so the three (u,v) points at differnt positions are your radial points. When you fit the circle to the three (or more points), you can extract the center around which the dark spot is rotating.
Can you post images with two or three different positions? It is hard to tell what changes with a single image. Is it just the tiny circle in the center, or the entire bar shape that rotates?