Problem with minsize in LargeScaleMeanShift

The following runs

otbcli_LargeScaleMeanShift -in ‘PL20200706_MICAPCAc_sub05.tif’ -spatialr 5 -ranger 5 -minsize 1 -mode.vector.out MSw05_s5_r5_m1.shp -ram 256
otbcli_LargeScaleMeanShift -in ‘PL20200706_MICAPCAc_sub05.tif’ -spatialr 15 -ranger 5 -minsize 1 -mode.vector.out MSw05_s15_r5_m1.shp -ram 256
otbcli_LargeScaleMeanShift -in ‘PL20200706_MICAPCAc_sub05.tif’ -spatialr 21 -ranger 5 -minsize 1 -mode.vector.out MSw05_s21_r5_m1.shp -ram 256

all produce a 1 pixel grid segmentation:


(zoom at the upper-left corner)

According to the doc, “Minimum Segment Size. If, after the segmentation, a segment is of size strictly lower than this criterion, the segment is merged with the segment that has the closest sepctral signature”. Rather, it seems like here 1-pixel segments have been enforced.

If I set -minsize 20, I do get a reasonable segmentation, but identical in all 3 cases:

otbcli_LargeScaleMeanShift -in ‘PL20200706_MICAPCAc_sub05.tif’ -spatialr 5 -ranger 5 -minsize 20 -mode.vector.out MSw05_s5_r5_m20.shp -ram 256

(zoom upper-left corner)

Instead, if I use otbcli_Segmentation, the minsize=1 parameter seems to work fine:

otbcli_Segmentation -in ‘PL20200706_MICAPCAc_sub05.tif’ -filter meanshift -filter.meanshift.spatialr 5 -filter.meanshift.ranger 5 -mode vector -mode.vector.minsize 1 -mode.vector.out ‘MSw05_s5_r5_m1_B.shp’

Input image: Dropbox - PL20200706_MICAPCAs_sub05.tif - Simplify your life

Hi @alobo,

Thanks for feedbacks.

The merging step at the minsize = 1 should not produced any processing.
And the segmentation shouldn’t produced only 1 pixel segments.
It’s certainly a processing issue.

We will look at this issue. We let you know.

Best regards,