Image Classification

Dear

I am very new when it comes to images classification. For this reason, please, I would like to ask for some piece of advice. I am working with MODIS-Aqua image, which I applied a mask to find pixels with nLw(859) > nLw(678). From these pixels I need to classify which of them are far from clouds at least 3 pixels distance, and also which of them present the 5 pixels surrounding with the same criteria (nLw(859) > nLw(678)). Which type of Classification in the SNAP do you advice me to use?

Thank you very much for attention and helping

Best regards

Amália

I haven’t worked with MODIS in SNAP but you could get good results with the filter options

if your mask consists of 0 and 1, you can apply a maximum filter of 5x5 pixels to set all pixels within this distance to clouds to 1 as well. You can then subtract this binary raster from another one (e.g. the original mask) in order to refine your result.

2 Likes

I had the same idea as @ABraun, but he was faster :slight_smile:
In addition, if you use Modis L1B you can use IdePix (Optical / Preprocessing / Masking / IdePix / Modis) to get a cloud mask (incl. cloud buffer).

1 Like

Thank you for responding and helping. I really appreciate it.
However, I have some doubts.
I already have applied the first criteria (nLw859 > nLw 678) like a Mask. Then, I did what you suggested (maximum filter of 5x5 pixels). However, I cannot see the Spectra View for these 5 pixels surrounding. Thus, I need to find a way to classify these 5 pixels surrounding (the value is 255 in the image), which presents the criteria nLw645 > nLw678 and nLw859 > nLw678. And, in the end, classify which one is far from clouds by 3 pixels.
How can I be able to apply a New Mask in this image generated after applying “maximum filter of 5x5 pixels”?

Thank so much for helping and your attention.

All the best,

Amália

First you create a binary raster consisting of 1 and 0 which shows the pixels you are interseted in as 1.
Second you multiply this binary raster with your MODIS band. The resulting raster will have the modis values at the corresponding areas while all other pixels are zero.

I am a bit confused about what you are trying to achieve at the end so sorry if I understood it wrong.

I am so sorry for not clarifying you the issue in my last email.
I would like to describe a spatial geometry of the marine algae slicks. The first criteria that I applied (nLw 859 > nLw678) I found them but more outliers pixels together. These outliers probably showed because of cloud signal interference.
In order to achieve only the slicks (“s”) location, I need to certify if there not responses in the surrounding 5 pixels (nLw645 > nLw678 and nLw859 > nLw678), then it may not be a slick, and if it is within 3 pixels of a cloud, then it is not a slick.
However, I thought I would apply some Classifier. Please, do you have some piece of advice what I should do? I will really appreciate if you could kindly walk me through how to handle this issue.

Thank you very much.

Best,

Amália

you can combine different conditions in the band maths with
IF x=0 THEN 1 ELSE 0

So first you make a mask with the condition of your algae
Second you make a mask with the clouds

Then you define:
IF mask_cloud == 0 THEN (IF mask_algae == 1 THEN 1 ELSE 0) ELSE 0

This gives you all pixels which are within your algae threshold but outside the cloud areas defined by the filter.

I am so sorry my delay to answer. I had to solve other things in the lab.
I am still trying, but I like your idea to create this type of mask.
I really appreciate it.
Any more doubt, I will get in touch!

Thank you so much.

All the best,

Amália