Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract the lines from the image

Hi Everyone,

 

I have an Image. In that, a circle object (plastic material) placed at centre with dark background. When the light is allowed to propagate through the plasic ring, It is getting disturbed by the cut made in that. When light allowed to pass through, we can see some lines (via camera) in the plastic ring. Now I need to count the number of lines in the plastic ring programatically using Vision. How to start this ??? I m new here, so please treat me like a baby...Smiley Tongue

 

Find the sample Image below.

I am using NI Vision assistant & Labview 8.2.1.

 

 

Thanks in Advance

0 Kudos
Message 1 of 10
(5,694 Views)

If these are always the same shape, you could use an annulus to select the area with the lines.  Use IMAQ Unwrap to straighten this out to a strip.  Use IMAQ LinearAverages to get the average of the  values in each column.  Wiring this into Threshold Detector should give you a count of the peaks.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 2 of 10
(5,663 Views)

Dear Bruce Ammons,

 

I have jus try to implement the idea you suggested me. But I get stuck when straightening the lines using IMAQ Unwrap. It always returing an error (Invalid ROI). Kindly find the code below and suggest me a solution.

 

 

0 Kudos
Message 3 of 10
(5,649 Views)

After the image loads, use the mouse to create the annualus so that it's inner and outer circles surround your ring, then press the Enter key on your keyboard.

 

-AK2DM

 

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 4 of 10
(5,637 Views)

I followed the same procedure in Labview 8.2 and it doesnt work (Returns an error: Invalid ROI). Then I started the same programming in 2013 and its working good. I really dont know why ?????!!!!!!!!

 

Now the problem is different. After thresholding the image, it stays with some noise. I need to eliminate all and count the number of lines in the image. How to do that ???

Here I dont see any function like Threshold Detector like what  said.''

 

Refer the modified VI attached below.

 

 

0 Kudos
Message 5 of 10
(5,631 Views)

Hello,

 

I belive Mr. Ammons was refeering to the peak detector, for example:  http://zone.ni.com/reference/en-XX/help/371361J-01/lvanls/peak_detector/

 

IMAQ also has such functions, under the "caliper" pallete I think.

 

Additionally, prior to peak detection I would apply a low-pass filter (box/smoothing or Gauss) on the unwrapped strip to atenuate the higher frequencies.

 

Best regards,


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 6 of 10
(5,622 Views)

I assume you understand how to draw the annulus now.

 

I would not threshold the image.  There is no reason to do that.

 

I agree with a smoothing filter being helpful.

 

If you use Quick Drop, you can type in the name of the vi and it will work.  Threshold detector will count how many times the signal goes above a set level, so it will count your rings.  You can do the same thing with peak detector, but it requires several steps.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 7 of 10
(5,616 Views)

Hi BruceAmmons,

 

I found the Threshold detector and applied. It detects 76 lines in the Image. But there are totally 138 lines in the Image. Moreover, Everytime I need to select the annulus manually ( Because of this, No of lines found also keep on varying). But I want my code to automatically detect the Circle diameter, from that it should sketch the annulus. Is it possible  ??? 

 

Consider the attached VI

0 Kudos
Message 8 of 10
(5,572 Views)

This is the Idea, which I developed. I got my output. Please look into it. Notify me If there any Unwanted steps I used. 

 

 

0 Kudos
Message 9 of 10
(5,570 Views)

It could be many things.  If you make the annulus too wide, or if it isn't centered on the circle, you will blur the lines too much to recognize the peaks.  I also assume the Threshold Detector has a few parameters that could be adjusted.

 

Bruce

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