Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect dark 'needle' on light background (360°)

Solved!
Go to solution

Hi,

 

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?

 

Kind regards,

Henk

0 Kudos
Message 1 of 27
(5,794 Views)

Hello,

 

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.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 2 of 27
(5,767 Views)
Thanks for your fast response, but how do you create a circle?
0 Kudos
Message 3 of 27
(5,753 Views)

And can I use an example that already exists or do i have to write an whole new VI?

0 Kudos
Message 4 of 27
(5,746 Views)

Hello,

 

the simplest way is to use IMAQ Fit Circle.

Of course, every specific application requires some extent of coding.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 5 of 27
(5,726 Views)

How can you get the radial points? do you have to set them in the picture by clicking or something?

0 Kudos
Message 6 of 27
(5,721 Views)

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°

0 Kudos
Message 7 of 27
(5,719 Views)

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°

Download All
0 Kudos
Message 8 of 27
(5,719 Views)

Hello,

 

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.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 9 of 27
(5,708 Views)

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?

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 10 of 27
(5,699 Views)