Now I will mention the actual segmentation of the layerstacked feature vector.
I wrote a wrapper script around it to perform the segmentation itself, setting the smallest size of segments at 0.2 square kms. I calculate the number of pixels that is depending on the DTM resolution. This can be extracted via the gdalinfo command-line script.
One detail is that I added 9999 to all fields before using the segmentation, since the segmentation didn't work properly with negative values, which are encountered in Martian DTM data, and also in the DTM curvature fields.
There is a subtlely not mentioned in the above flowchart, is that I add the statistics from the original image file (i.e. without the +9999) to the clumps file from the segmentation to the RAT table.
|Clumps file in TuiView for tile h2224 covering Greg crater, after the addition of the clump statistics to the RAT.|
In one version of RSGISLib, it didn't include the objectID in the raster attribute table, which I then added back in manually with a Python script.
The gdal_polygonize command takes the segment clumps file and makes it into shapefile polygons.