Segmentation Bias Towards Rivers

I am segmenting fields along the Peruvian Amazon. I am using an average NDMI stack of images as my input into Large Scale Mean Shift segmentation.

Inputs
Spatial Radius: 3
Range Radius: 0.14
Minimum Segment size: 3

The result is always a bias towards rivers. The documentation says that NoData values mess with the LSMS. How should I contend with water?

It would be great to only segment pixels with NDMI values between 0.2-0.5

Thanks

Hi Tristan,

Thank you for your message. Can you explain what do you want to segment ? How many bands has your image ?
Maybe the segmented shapes on the river comes from bands of the image stack that we cannot see on your screenshot ?

Could you send us an extract of your image ?

Thanks in advance,

Yannick

Hey Yannick,

Thanks for your quick reply.

I am interested in segmenting agricultural fields based upon their spectral similarity through time.
I am currently using a single band, which is an average of NDMI calculated in 10 different years.

NDMIstackaverage_subset.tif (769.6 KB)

Would you recommend using a 10 band image with each band being the NDMI calculated each of those 10 years instead?

From the attached subset, it would be great to have segments of fields that look like this:

Thanks!

Hi Tristan,

We made several tests on your image.
The LargeScaleMeanShift does not seem to be appropriate in your case : it will segment the whole image, and you will still have to select the relevant polygons.

But there may be simpler methods to segment your image :

  1. Use the connected component application, for example with these parameters :
    { ‘in’ : ‘NDMIstackaverage_subset.tif’, ‘out’ : ‘your image’,
    ‘mask’ : ‘b1>0.22 && b1 < 0.32’,
    ‘expr’ : ‘distance < 1’,
    ‘minsize’ : 2,
    ‘obia’ : ‘SHAPE_PhysicalSize < 20000’, }
    The “mask” will allow to select a range of pixels to process. The “obia” expression will select shapes smaller than 2 Ha (assuming your image is a Sentinel2 at 10m resolution)

  2. Use BandMath to filter values in a defined range (for example, [0.22 ; 0.32]) and use the BinaryMorphologicalOperation to dilate or erode the shapes. Then, using gdal_polygonise, you can transform your raster into a shape file containing the different shapes.

Hope it helps !

Yannick

Hey Yannick,

Thanks for your methods, they are producing closer results. I want to fiddle around with some of the inputs. I am not familiar with the OBIA expressions. Where can I find other expressions?

My PI wants to replicate these methods closely:
DutrieuxSegmentedFields.pdf (873.7 KB)

I believe he may ask me to segment using LSMS as the authors did (page 117: 2.5. Spatial Segmentation)
Quote from page 117:
“We used a mean shift segmentation algorithm, as implemented in the Orfeo ToolBox (www.orfeo-toolbox.org) (version 4.2.0) to perform the multi-temporal segmentation (Fukunaga and Hostetler, 1975; Inglada and Christophe, 2009). A NDMI time-series, which we assembled by building annual mean value composites resulting in one average NDMI value per year, was used as input data. … The resulting NDMI stack used as input for the segmentation contains 25 layers spanning the 1986–2014 period. The mean shift segmentation algorithm requires as input parameters a range radius, a spatial radius and a minimum object size. We chose for the range radius, which is the similarity (Euclidean distance) measure for a pair of pixel profiles, a value of 0.14. Such value exceeds the natural variability between two similar pixels while successfully differentiating two pixels with different land use trajectories. A too small range radius value has the effect of over-segmenting the area, while larger values have the opposite effect. Based on a-priori knowledge of the system, we set the spatial radius to three pixels and the minimum object size to three pixels (Jakovac et al., 2015). This initial segmentation step results in many segments, some of which are not swidden agriculture. Since we are only interested in the swidden agriculture fields, we applied a set of rules to filter and keep only those polygons that delineate areas of swidden agriculture. First, we discarded objects larger than 15 ha, which is larger than the average field size of 1 ha, usually found in the area (Jakovac et al., 2015). Following that we used the NDMI time-series associated to the segments in order to filter out remaining segments of stable forest (NDMI never falling below 0.3), and urban areas, permanent agriculture and wetlands (NDMI never exceeding 0.3).”

This output using LSMS produced this segmentation:

Do you have a suggestion for how this might have been achieved using LSMS?
I used the same inputs of the NDMI multiyear stack, 0.14 range radius, 3 pixel spatial radius, and 3 pixel minimum object size

Thanks so much.

Hi Tristan,

OBIA expressions are not very well documented in OTB. Some information can be found in ITK or OTB source code, but I found a very old wiki page that lists some expressions :
https://wiki.orfeo-toolbox.org/index.php/Connected_component_segmentation_module
At least, the keywords in Italic (like SHAPE_PhysicalSize) seem to be correctly interpreted.
We are going to open an issue to improve documentation of this application ; feel free to report any bug or feature request on our Gitlab.

For the second point, I’m not an expert in your field of studies, but I think this problem can be addressed by some filtering methods, and then manual segmentation (as those I proposed in my previous post), or maybe by a classification method. As you want to classify areas depending on their moisture on a large temporal scale, I think it could be done by the classification framework, using a supervised method (ex : Random Forest) if you have some ground-truth, or with a clustering methode (ex : K-Means).

And as I understand your article, LSMS algorithm has been used on a stack of NDMI (multi-band image) :

I’ve never used the LSMS algorithm on such multi-band image, but if it works fine, you can share your experience on this forum !

Best regards,

Yannick

Hey Yannick,

Using LSMS on the multiband worked like a charm

Thanks so much

Best,

Tristan