I would like to identify the white spots in a greyscale image and calculate the area among other things.

enter image description here

I have tried to identify the white spots with:

markers = MaxDetect[GaussianFilter[img01, 60], Padding -> 1];
HighlightImage[img01, markers, Method -> {"DiskMarkers", 5}]

enter image description here

Is there a way to find the edge and calculate the area?

I would also like to scale it up to a larger picture with many spots, which seems to bring a lot of problems

  • $\begingroup$ Have you tried using a high pass filter? $\endgroup$
    – Sâu
    Dec 24, 2020 at 1:23
  • 1
    $\begingroup$ I think the first thing is to decide what you want to measure. What exactly counts as the white spot? How should one decide whether a pixel counts as part of the white spot or not? $\endgroup$
    – MassDefect
    Dec 24, 2020 at 4:43

1 Answer 1


Taking a look at the histogram of the image, one can see that the white pixel intensities ranges roughly between 0.85 and 1.

Image histogram

It is safe to assume that the pixel intensity on the upper bound corresponds to the brightest spots since it has the highest distribution. Therefore, Binarizing it with a very fine threshold of 0.99 and then using median filter to remove the salt noise we get the following:

MedianFilter[Binarize[img, 0.99], 4]

Binarized picture

Further processing (Calculating the area of white spot) should be fairly simple from this point.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.