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:

1 Like

The spatial radius parameter in Orfeo refers to the size of the support window for image segmentation. The term “radiometry unit” in this context might be a bit confusing. Let’s break it down:

  1. Spatial Radius:
  • This parameter determines the neighborhood size considered during segmentation. A larger spatial radius includes more neighboring pixels in the analysis, potentially resulting in smoother and larger segments.
  1. Radiometry Unit:
  • The term “radiometry” generally relates to the measurement of electromagnetic radiation, which includes the values of pixel intensities in remote sensing imagery.
  • In the context of Orfeo, the spatial radius is not explicitly tied to a specific unit like meters or pixels; instead, it refers to the size of the neighborhood in terms of the pixel values in the image.

In simpler terms, the spatial radius is expressed in the same unit as the pixel values in your image. For example, if you are working with multispectral or hyperspectral imagery, the pixel values represent radiometric information (intensity at different wavelengths). The spatial radius is then a measure in these radiometric units.

Practically, the best way to understand the effect of the spatial radius is through experimentation. Try different values and observe how they impact the segmentation results. It’s often a balance between considering enough spatial context for meaningful segments and avoiding over-smoothing or merging of distinct features.

If you have specific data types or scenarios in mind, feel free to provide more details for a more tailored explanation!

1 Like