Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

detection of black area size

for a project i am working on i have used filters and blob detection to seperate blobs from my background resulting in a binary image. part of the project requires checking the pattern for the presence of blobs in the raster. in my raster any completely black area of about 8x8 pixels or larger signifies a missing blob.

i have tried using the pattern learn and find VI's to find these areas. but these VI's require contrast in the image.

so, my question is: is there any way to search an image for the location of a black area of at least the specified size on a largely black background?

 

on a side note, i am currently using labview 7.1, and as a student there is verry litle posibility of upgrading any time soon.

 

any help would be appreciated.

 

Jasper

0 Kudos
Message 1 of 10
(3,582 Views)

Is it as simple as inverting the binary image, then using blob analysis to measure each blob?  You can measure width, height, area, etc.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 10
(3,572 Views)

i wish it were, but the problem is that for this part i'm not interested in the blobs. i am interested in the spaces between the blobs, i'v added a simple image i threw together in paint that roughly shows the situation. the red outlined area is what im interested to detect(note, the red outline is just for example, normaly there is no contrast there what so ever). the main problem is that im trying to detect a black area on a black background, the only distinct characteristic of the region is its size.

0 Kudos
Message 3 of 10
(3,567 Views)

I understand the problem now.

 

Perhaps binary invert, then use erode to eliminate the thin areas.  Ten iterations of erode would remove all but the large areas.

 

Another similar idea would be to use IMAQ Daniellson to measure each pixels distance from the edge, after inversion.  Your large black areas would have large distances, while the thin areas would have small distances.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 4 of 10
(3,558 Views)

Thank you for the suggestion, I've run a quick test using inversion and erode. So far it seems to work decently on the currently available test images I have. However, these test images still have a large difference between the raster line width and the blob size. My eventual images will most likely have a severely smaller ratio which might be a problem with this method.

As for the daniellson measurement, I will leave that for tomorrow. though the amount of blobs( currently about 80k-100k, scales up to 1M could be needed) might be problematic for this.

i will work on getting better test images tomorrow and i will keep you posted.

 

Jasper

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

Daniellson has nothing to do with the number of blobs.  It measures the distance from each pixel to the edge.  It is pretty much the same as doing multiple erosiions, but it shows you the results of each erosion as a level.  The outer surface will have a value of 1, the next layer 2, etc.  Since you will be inverting first, it will give you an idea of how thick each dividing area is.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 10
(3,549 Views)

i did several tests with better images today, once again the inversion and erode combination worked really well. it currently isnt possible to acquire images of the exact scale that i will use eventualy, but today's tests were promising.

as for the danielsson, i could not get it to work. what ever i used for input, the output was always a completely black image but the error was 0. i will probably look in to this some other time, but for now the other method looks like it will be sufficient.

 

Jasper

0 Kudos
Message 7 of 10
(3,534 Views)

Try inverting your binary test image, then running Daneilsson.  Display the resulting image using the Binary palette, or the Gradient palette.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 8 of 10
(3,525 Views)

I've taken a more thorough look at the danielsson method now, and it works quite well. The earlier problem was due to the small sizes of my blobs and the area's in between. There was no distinguishable difference in the image, but after looking at the histograms and applying another threshold I could see it was working. Though if I understand correctly I think I have just made the erode function by combining the danielsson with a threshold.

 

Jasper

0 Kudos
Message 9 of 10
(3,505 Views)

Yes, combining the Danielsson method with thresholding gives you the same results as erosion, or close enough.  There might be an advantage keeping them separate, though.  You might be able to analyze your Danielsson results to decide what the best threshold level is.  The histogram of the Danielsson results gives you the number of pixels that would be removed with each erosion.  I would assume there would be a big drop once all the dividing sections are gone.

 

Another idea I had was to use the skeleton function and combine it with the Danielsson results.  The values on the skeleton would give you the width of the strips.  Not sure if that information would help you in any way, though.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 10 of 10
(3,497 Views)