Range radius compression for multispectral images during the mean-shift segmentation process

I’m starting my studies on satellite image segmentation at OTB. I did a search before here on the forum to see if there are some things that could help me, some clarified me, but I still have doubts to “draw” it in my mind.

After a lot of research, one of the most complicated parameters to understand is the “range radius”, besides I see that it is very important.
my ref:

I understood that it “is the Euclidean distance that measures the difference, in spectral terms, acceptable to include a pixel in a certain segment (group)” (check if that’s right).

My doubt is: Does this spectral difference refer to the whole image or to a set of target objects?

Considering a multispectral image with three bands (size 3x3 pixels), how would I determine the Euclidean distance (range radius) in a single number of these three bands? (I don’t know if I’m on the right path or confused).

|50, 52, 48|
|51, 51, 47|
|50, 52, 45|

|70, 83, 100|
|91, 91, 101|
|93, 89, 108|

|197, 192, 193|
|189, 191, 190|
|193, 189, 201|

Dear @wesleysc352,

Thank you for using OTB!

MeanShift is a pixel based segmentation.
Here are the steps of the algorithm:

For each pixel

  • Compute the euclidean distance between the spectral values of the pixel and the spectral values of its neighbors (the size of the neighborhood is set with the spatialr parameter).
  • Compute the average of all pixels with distance lower than the ranger parameter.
  • The value of the pixel is set to the computed average.
  • Iterate until convergence (changes during the iteration are lower that thres) or stop after maxiter iteration.

The documentation of the application is here, it gives some more details on the algorithm.

If I take your 3x3 image example, and I consider the pixel at the center (spatialr=1), I can represent it as a vector like this [51, 91, 191].
I then compute the distance for each neighbor:
[50, 70, 197] → 21.86
[52, 83, 192] → 8.12
[48, 100, 193] → 9.7
[51, 91, 189] → 2
[47, 101, 190] → 10.82
[50, 93, 193] → 3
[52, 89, 189] → 3
[45, 108, 201] → 20.62

Let say ranger is set to 5, then you keep the pixels [51, 91, 189], [50, 93, 193], [52, 89, 189]. The mean is [51, 91, 190,5]. This is the new value of the central pixel.

2 Likes

I didn’t understand exactly how you arrived at the calculations of the distances of the vectors. I did it like this:

√((50 - 51)² + (70 - 91)² + (197 - 191)²) = 12.65

while your result gave: 21,86

So you suggest that the range could be between
2 and 21.86?
A good value for range radius should be in this range 2-21.86?

Greetings

Your formula is correct, but not your result:

√((50 - 51)² + (70 - 91)² + (197 - 191)²)
= √(1² + 21² + 6²) 
= √(1 + 441 + 36) 
= √(478)
= 21.86...

The range depends on the dynamics of the image and the type of objects that can be found on it. This is why I can’t give you a typical value. I suggest that you try different values, to see what happens.

1 Like