Unit of spatial radius in segmentation

Hi!

I am quite new with using Orfeo and got a question regarding the unit of the spatial radius which is used for segmentations.

I understand so far that the parameter controls the size of the support window for the segmentation. I also read in the cookbook that the parameter is expressed in radiometry unit. However, I don’t quite understand what that means and would be grateful if somebody cared to explain since my research on that topic has not been very successful so far.

Thank you!

Hi @annima

In the code I can point you this line, which could give you a hint about what you are asking for.
meanShiftVectorizationFilter->GetSegmentationFilter()->SetSpatialBandwidth(spatialRadius);

In the meanshift filter documentation, you can read the following :

/** Sets the spatial bandwidth (or radius in the case of a uniform kernel)
of the neighborhood for each pixel **/
  otbSetObjectMemberMacro(MeanShiftFilter, SpatialBandwidth, RealType);
  otbGetObjectMemberConstReferenceMacro(MeanShiftFilter, SpatialBandwidth, RealType);

  /** Sets the spectral bandwidth (or radius for a uniform kernel) for pixels
   to be included in the same mode **/
  otbSetObjectMemberMacro(MeanShiftFilter, RangeBandwidth, RealType);
  otbGetObjectMemberConstReferenceMacro(MeanShiftFilter, RangeBandwidth, RealType);

And furthermore :

The spatial and range radius parameters allow adapting the sensitivity of the algorithm depending on the image dynamic and resolution

So i think the range radius is the spectral radius, which is probably in nm (in terms of image dynamic)
and the spatial radius is the number of neighboors so without a specific unit

I hope it helps a little bit in your path to the answer

Best regards

Dear @annima,

Thank you for using OTB :slight_smile:

I suspect you are confusing spatial and range radius.

The Spatial radius (spatialr) parameter is expressed in pixels. If you set it to 1, the algorithm will use a 3x3 window around each pixel for averaging step. If you set it to 4, the window will be 9x9 pixels.

The Range radius (ranger) parameter is expressed in radiometry unit. This means it depends on the value of radiometry of the image you are processing. It is used as a threshold on the averaged radiometry in the neighborhood if each pixels.

Julien :slight_smile: