01-19-2018 09:31 AM
Hello,
Actually i asked this in an onether entry. But i think it's a new subject. I apologize in advance if it's double entry
https://forums.ni.com/t5/Machine-Vision/Marble-slab/td-p/3708856/page/4
I have marble slabs. With line scanning get i image of these marble slabs. In result image background is extremely dark. But background is not completely dark (it's no-uniform). If you look carefully, you can see some parts on background that not total black are (contrast enhanced image_01) . Most marble slabs have some dark areas, too.
I want to find contour of these marble slabs. To do that first i need to separate marble from this background. I use manual thresholding (thresholding bright objects, see attached script). I can't find an auto thresholding methode for this. Manual thresholding doesn't always work for me. Sometimes i have to change lower value for manual thresholding. I don't want this.
Is there a better way to that? I think i might use some gray morphology before thresholding. Any ideas?
01-19-2018 11:23 PM
I see what you mean with the two example images.
How about color thresholding + some IMAQ FillHoles? Does the attached script work consistently for you?
01-20-2018 03:12 AM
We have always different marbles. Size and color are changing. There are dark marbles but bright marbles, too.
Some marbles natural holes on them. We want to detect these holes, too So, i rather don't want use "fill holes"Marble slab with holes
01-20-2018 08:08 AM
That's actually quite a more interesting problem than I thought 🙂
Now there are two paths I would try (I don't really know how much your images vary..)
1) Build a threshold that first distinguishes between background and marble slab (cracks considered foreground/marble) including FillHOles..
I would personally use local statistics for it, seems like the background is very dark, has low minimum values and low std deviation.
Mask the background (make it totally black), then use a second mask..
(IMAQ BlockStatistics is your friend)
2) H-Dome Binary reconstruction thresholds. That algorithm is a bit a long story to explain.. ,in essence, it reconstructs local maxima/minima.
Has two parameters: The delta which is recognized as a relevant and the area in which it looks.
I attached an example that works with the pics you attached.