# 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.

This will provide you a window with the following information:

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

So there are multiple ways.

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!