Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use IMAQ Vision to inspect this kind of scratch?

I am now using IMAQ Vision to do some automatic inspection and having a difficulty in inspecting non-distict scratches(attached below).Dose anyone have ever done this? Which VIs of IMAQ Vision can help me finish this inspetion.
0 Kudos
Message 1 of 10
(4,645 Views)
First, you should try to improve the image quality : the scratch is difficult to see, even by eye. May be you could improve the lighting, using 2 sources disposed at a relative angle of 90°.
Then, image enhancement is straight forward ;):
- use a laplacian filter to amplify the lines (disk edge, scratch and noise...),
- threshold the image (that's the most critical step !!!),
- remove the smaller objects (noise),
- apply a close operation (dilation+erosion) to connect the scratch fragments,
- select the particles according to their compactness factor (ratio between enveloppe area size and actual area.

If you have NI Vision Assistant, run the attached script. Otherwise, I'll try later to send you the corresponding vi (I have problems with files larger than 26 ko).

Happy wiring !

CC
Chilly Charly    (aka CC)
Message 2 of 10
(4,622 Views)
Hi charly
Thanks for your advice!
I would try your method right now and improve my lighting later.
I'm sorry I can't open the attached script. If you can,please e-mail the corresponding vi to me:yzshenhao@hotmail.com

Best wishes
SimonShen
0 Kudos
Message 3 of 10
(4,606 Views)
I have sent the vi by mail. Runs with LV 7.1 and IMAQ vision 7.0.1.
Slight modification from the previous script : included an overlay to visualize the scratch position.
As I told you, the threshold step is decisive, and depends strongly on the quality of the lighting. You will probably have problems with other pictures. Another possible issue is with the jpg compression step. Don't know what will happen with original pictures.

Enclosed is an image of what you should get.

Hope this helps,

CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 10
(4,591 Views)
Hi CC
I have received your mail. Thanks for your help!
The LV I used is 6.1 and IMAQ Vision is 6.0
So I can't open your vis. Sigh!:(
But still thank you very much!
The below list is my steps for scratch detection:
1.Use a laplacian filter to amplity the lines
2.Threshold the image
3.Remove the smaller objects
4.Apply a dilation operation to acquire a image,named A
5.Apply a Auto median operation to acquire a image,named B
6.Subtract B from A, acquire C
7.Use open operation on C, then fill holes, erosion,remove noise
8.OK. That's the result!

And I still have some problems:
1.It looks that my result is less precise than yours. Would you please show me the main different steps of yours?
2.How can I use an overlay to visualize the scratch position?
3.Which type of image is best for processing original picture, BMP,TIF or others?

Best wishes
SimonShen
0 Kudos
Message 5 of 10
(4,574 Views)
0 Kudos
Message 6 of 10
(4,567 Views)
0 Kudos
Message 7 of 10
(4,566 Views)
0 Kudos
Message 8 of 10
(4,565 Views)
I can't save the vi to an older version, therefore I have sent a screen dump of the diagram (by mail).
The different steps correspond to the list I made in my first post, except that I filter the particles using the elongation parm (simple but potentially not working with multiple crossing scratches).
The overlay is drawn using the start and end coordinates of the scratch, got from IMAQ particle analysis.

Basically TIF and BMP are equivalent. JPG may introduce noise (see the Laplacian around edges) or loose details (such as scratches !)

CC
Chilly Charly    (aka CC)
0 Kudos
Message 9 of 10
(4,549 Views)
Hi CC
Thank you very much:)
I have done this!
0 Kudos
Message 10 of 10
(4,507 Views)