LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image morphology: using erosion after color selection

I need to identify a green circle and so far I've used the IMAQ ColorThreshold vi for colour recognition. Now I want to get rid of the noise with erosion and dilation but when I wire the vi, the image just goes black. What could be the problem? Also, I tried to wire the image src input to the original image then the image is just plain white. I link the picture

Download All
0 Kudos
Message 1 of 6
(2,887 Views)

A mistake I fall for every time is that Boolean operations return 0's and 1's. So you have to format the image as "binary" to see something.

0 Kudos
Message 2 of 6
(2,857 Views)

But why would this be a boolean operation? It's an image type no?

0 Kudos
Message 3 of 6
(2,841 Views)

A threshold returns 0's (above threshold) and 1's (below threshold). So the result is Boolean.

 

You don't need to change the image type, you need to change the color scheme.

 

A 0\1 still fits in a u8 image, but you won't see anything in the default color scheme. You'll need the Boolean color scheme, that has black as 0, and red as >0.

0 Kudos
Message 4 of 6
(2,832 Views)

I looked into what you said. But what I don't understand is that with both new image I set the image type to grayscale(U8) and I checked with the image info the output of the threshold and it's also grayscale. So why are they not compatible? I don't see that I would use the normal color scale anywhere, it should be boolean. Where am I wrong?

0 Kudos
Message 5 of 6
(2,806 Views)

U8 is just the data type to hold the data. A Boolean needs an U8 (at least), as there is no Boolean data type image.

 

The term " Grayscale(u8)" is just confusing. U8 and grayscale are mutually exclusive. You'll need an U8 image type, but a Boolean palette. A grayscale color scale will simply display 0 as black, and 1 as nearly black. Alternatively, multiply the image with 255. That will make the 1's 255's, and that will show up as white.

0 Kudos
Message 6 of 6
(2,802 Views)