Counting number of white pixels

Hello!
I have some binary tif images, which white areas are cloud mask. I want to compare these images by counting number of white pixels. How is it possible to do that by SNAP.
Thank you!

You can make an histogram of the image then look at the frequency of pixels whose value corresponds to “white”

Click on your band you want to study then
Analysis >> Histogram

1 Like

@qglaude that’s one option. The other is to create a mask.
As mask expression it should be possible to simply use the band name. If this doesn’t work an expression like bandName == value should do it.


Then you can compute the Mask Area (Raster / Masks / Mask Area).
This will provide you a window with the following information:
image

Or you go to Analysis / Statistics and compute the stats with the mask enabled.

So there are multiple ways. :slight_smile:

3 Likes

Thank you so much for your answers! One more question: is snap making comparison between two images and analyse in confusion matrix way, considering one of them is referance image? (like true negative, false negative, etc.)

No this is not really possible. You can make difference between two images if they have the same dimension. The result shows if they were equal or not. But a confusion matrix can not be generated.

Oh okay. They are actually same images but cloud masks are made by different algorithms. What do you mean by “making difference between two images”?

With the band math you can subtract one band from the other or do other arithmetical operations

Thanks a lot!