Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect Circle like Hough transform

Hi All,

 

I would like to detect circle on image - already edge detected and threshold-ed . Circle is white on black background. And I would like to overlay detected circle over white pixels.

 

NI IMAQ Detect Circles is detecting circle on edge between black and white pixels. And two circles are detecting as well, one internal on black->white edge and second on white->black edge.

 

As you should see picture could be 'noise' and from this reason something like Hough transform would be best. I think.

Thank you for your time.

Best regards

 Peter

 

Download All
0 Kudos
Message 1 of 9
(2,643 Views)

I would be interested to see the original unprocessed image.  I think there might be better ways to approach the problem.

 

What is the pass/fail criteria for the circle, or are you just locating it for position?

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 9
(2,611 Views)

Hi Bruce

 

Thank you for replay.

Goal is to find circle XY location and verify that size is as expected +/-5 % ish. Circle could be partial because it could be in shadow of some component.

 

Raw image is not image but 3D cloud converted to 2D raster and edge detected and thresholded to extract features.

 

From this reason I would like my circle radius + XY position because this is edge of object of interest.

I implemented my own Hough transormation in LV but I would like something faster. And I expected then IMAQ could do it.

0 Kudos
Message 3 of 9
(2,606 Views)

Is the circle always roughly in the same position?  If it doesn't move around too much, you can use a fixed annulus ROI and use IMAQ Find Circular Edge.  That should do a good job.

 

If the circle moves around quite a bit and you don't know where it will be in the image, you will need to do two steps.  The first will be to locate it, then measure it.  The strategy for locating it would depend on the amount of movement.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 4 of 9
(2,593 Views)

It is a lot harder to locate the circle when all you have is the edge.

 

I did a little testing in Vision Assistant, and the best tool I found was Shape Matching (under Machine Vision).  When I search for a circle and allow large gaps, it finds it pretty quickly.  It may not be a perfect circle, which makes it harder to locate.  Finding an ellipse might work better.  Setting the right ranges would find it accurately.

 

The same tool is available in LabVIEW.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 5 of 9
(2,590 Views)
  • Is the expected radius always the same in pixel units (± the error you are trying to find)?
  • Is the linewidth of the circle always around 1 pixel?
  • Is there always a concentric smaller circle with a size that is a known fraction of the bigger circle (~0.36 in this case)? (that could help!)
  • Your radius is about 46..47 pixels, so ±5% is just a few pixels difference. What resolution do you need?
  • Could there be more than one similar circle on a single picture?
  • How fast does it have to be?

The more you know about the data, the simpler the required algorithm.

 

If I do a 2D convolution with a small set of circles and keep the one that results in the largest amplitude, I get pretty close (Of course the center is quantized to pixels, but that could be improved):

 

altenbach_0-1626378675573.png

 

Here is the peak convolution amplitude as a function of radius:

 

altenbach_1-1626378970332.png

 

... and yes, if you explore a larger range of radii, you even get a second peak at the smaller circle

 

altenbach_2-1626379117175.png

 

 

Message 6 of 9
(2,588 Views)

Hi Bruce

Thank you for suggestion.

I am going to try it next week.

Best regards

 Peter

0 Kudos
Message 7 of 9
(2,461 Views)

Hi Altenbach,
Thank you for suggestion.

I am going to try it next week.

Best regards

 Peter

0 Kudos
Message 8 of 9
(2,460 Views)

Hi Peter,

It looks from the image you are trying to locate fiducials on electronic board.

Is that the case? I was working on project like that in the past.

What are your challenges? What are you trying to do?

For us the precision of finding the fiducial was the big issue.

But we had initial starting point that is close for the algorithm 

Amit Shachaf
0 Kudos
Message 9 of 9
(2,446 Views)