Inconsistent output from cluster grouping with bandmath.
Mantis Issue 692, reported by sdinot, assigned to ghost, created: 2013-04-08
When trying to regroup clusters from a kmeans classification with band Math, the final number of clusters is different from what is expected, and the groupings don't match with the specified intervals. The new clusters id are not the ones written in the script and classes from non specified intervals are included in the groupings.
The principle is to attribute cluster id 1 to clusters id from 10 to 19, 2 for the ones from 20 to 29 ..., with an expression like this : if((im1b1 >= 10 and im1b1 <= 19),1,if((im1b1 >= 20 and im1b1 <= 29),2, ...
The output image shows that for example that clusters id 21 and 31 have been grouped.
1365423191 - grizonnetmHi,
looking at your script and also to the input image, I think that you've got a problem with your input image you want to cluster.
I think that you try to apply the bandMath on the wrong output of the classification. In your archive, the crop_test_fusion_classif.tif is a multispectral image with value between 0-255. It does not seem to be a label image but the output of a color mapping operation.
You should apply it on a 1 band image where pixel values corresponds to the pixel class in this case it makes sense to apply the band clustering using the band math application.
Manuel
1365671630 - MartValHello,
Indeed, the issue was related to the image, I don't know exactly how it's been generated. I used the application on a SOM classification output and it works well.
Martin