I have classified 10 OLCI images from the same area and I would like to do a final image using the mode of the pixel of these 10 images. I would like to do something like a level 3 binning and the final image has the most frequent number of the classification (4 classes) on every pixel. Could anyone help me?
Unfortunately, this is not possible in the binning at the moment.
I’ve added it as a feature request to our issue tracker.
[SNAP-1409] Add MODE to the list of binning aggregators
I thought about a work around. You might give it chance.
You can split your bands and then count the number of occurrences of each class by the AVG aggregator. Based on this result you can create after the binning a new Band by Band Maths which selects most frequent value.
The expression might look like this:
(class_1_counts > class_2_counts && class_1_counts > class_3_counts && class_1_counts > class_4_counts) ? 1 : (class_2_counts > class_3_counts && class_2_counts > class_4_counts) ? 2 : (class_3_counts > class_4_counts) ? 3 : class_4_counts > 0 ? 4 : 0
An example binning configuration looks like this:
If you check a bit or for a certain value in the intermediate source bands depends on your data.
Thank you, your idea worked fine!