I have a DEM with small pits (one pit is approximately 5-10 cm wide, here shown as Hillshade).
I want to extract the ridges of these pits to have polygons out of each pit (like this where I did it manually)
The main problem is, that the for one pit the ridge on the right side f.e. is much higher than the one at the left side, because the overall of the wall is quite curved and seen from the front then the ridge on the left could have the same value than the "deepest" point of the pit. I tried to visualize what I mean - that is the wall drawn if you see it from the top.
So, on the one hand I tried to calculate the bigger mean of the whole area and then to nivellate the whole DEM to get it like in the picture above on the right side. However the problem is that my whole area is not only going convex but also concave and in all possible directions so that it is not possible to nivellate it properly.
The solution I reached up to now is, that I calculate the curvature and then thinning the areas. However, the thinning resolved on lines being not properly on the ridges and some weird polygons that do not match at all - see below. I also tried it with Topographic Position Index, however, the ridges are not marked well enough in many cases to close the pits into single polygons.
Does someone have another idea how to be able to extract those ridges as good as possible?
I am open to all kinds of software and solutions: ArcGIS, QGIS, R, Python,...