5
$\begingroup$

I have multiple grayscale images where I want to identify elevations: I have to find the convex hull that encloses the base of each hill. An example image:

Example image

The images are already normalized, background-gradient-removed, and filtered to get rid of sharp features and noise. Areas with less contrast are due to heavy noise, not much can be done against it.

My method so far is satisfactory, but not perfect.

img= Import["https://i.stack.imgur.com/vxdI4.jpg"];
fun = {
  HistogramTransform@ImageAdjust@LaplacianGaussianFilter[#, 24] &,
  ColorNegate@Closing[LocalAdaptiveBinarize[#, 10], DiskMatrix[12]] &,
  Show[HistogramTransform@img, 
    Graphics[{EdgeForm@Red, FaceForm@None, 
      Polygon@#[[First@FindCurvePath@#]] & /@ (Last /@ 
         ComponentMeasurements[#, "ConvexVertices"])}], 
    ImageSize -> Small] &
  };
FoldList[#2[#1] &, img, fun])

Mathematica graphics

My questions are:

  • How to properly detect the background elevation? That is, the level of (supposedly) uniform gray against which hills' footlines (area, height, etc.) can be detected?
  • How to respect the direction of illumination? Note, that this may change in different images. At present, the detection polygons are shifted toward the lighter part of each hill.
  • How to better separate hills? Some hills are not detected due to low contrast, some are joined with neighbouring ones. Since hill-shape and area is important, I prefer not to rely on extensive morphological dilation/erosion (Opening, Closing).
$\endgroup$
  • $\begingroup$ Have you tried something like ImageApply[Abs[#-mean],img] where mean=Mean@Flatten@ImageData@img? This might help a bit with the problem that the detected peaks are shifted. $\endgroup$ – Lukas Lang Aug 15 '17 at 16:14
  • $\begingroup$ @Mathe172 How exactly do you suggest using this? If I apply this on img directly, it just separates lighter and darker areas, but then binarization becomes problematic. $\endgroup$ – István Zachar Aug 16 '17 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.