LSMSSegmentation guidelines and parameters range choice

Greetings everyone,
I have a general question regarding if there are any existing guidelines on the parameters choice of the spatialr and ranger values. How do I understand the range I need to apply in order to test different values to pick the best results regarding my application etc?

More specifically, consider I use UAV very high resolution ortho images with pixel size of ~8cm with data from a multispectral sensor, and I use e.g. 2 or 3 bands, like RGB.

How do i pick a value range for the params?
I have tried a lot of things, and at some range the outputs do not change at all, not even the number of segments.
More specifically, the only thing that seems to matter in all of my combinational tries with extreme ranges of values is the “ranger” radiometric distance parameter, and neither “spatialr” nor “minsize” make any difference at all in the resulting segmented output.

Thanks in advance for helping me to get a deeper grasp of the segmentation algorithm

Hi,

First of all, LSMSSegmentation is part of a larger framework (see the recipe here : https://www.orfeo-toolbox.org/CookBook/recipes/improc.html#large-scale-mean-shift-lsms-segmentation) with a smoothing step, a segmentation and then post-processing of small areas.
I suggest that you fine tune the parameters on a small crop of your image, and evaluate the final result.
Then you will be able to apply it to the whole image.

About the parameters, the range value must be estimated considering the pixels range. It depends on the encoding / on the values taken in the image. How close can be two pixels to be considered as neighbours ? If you have 8 bit encoding (0…255) or 12 bits encoding (0…1024), or reflectance values, the range threshold will be different.
The spatial radius must be compared to your ground resolution : you can start with a small number of pixels (ex : 3 ?) and may increase it (but it will increase computation time).

At the end, do not forgot to apply the small regions merging, to improve your final segmentation.

Hope it helps !

Yannick

2 Likes

Thank you very much for the answer Yannick, it is appreciated!

I have read the overall process, and my issue is around the segmentation step, which is the core of the pipeline. I do smoothen the image generally however beforehand.
The question is how to estimate “How close can be two pixels to be considered as neighbours ?” Is there an intuitive way? A mathematical way? How does one estimate that in the multispectral (multiple feature space) domain?

Best piece of advice for everything!: “I suggest that you fine tune the parameters on a small crop of your image, and evaluate the final result.”
Cheers

The question is how to estimate “How close can be two pixels to be considered as neighbours ?” Is there an intuitive way? A mathematical way? How does one estimate that in the multispectral (multiple feature space) domain?

I think you have to consider the values that a pixel can take in each band. Then, you can start with a small percentage of the range (ex : 5% of a value between 0 and 255 → ~ 7).

Maybe other people with more experience in segmentation can give you better advice !

Best regards

Yannick

Thanks a lot once more Yannick!
Unfortunately I get very strange results in general playing with different values at a range that does have an impact, but I still cannot get a real hold of the way it functions in just a two band composite input.

I would greatly appreciate any guidelines from anybody with segmentation experience as said.

All the best!