Search code examples
imagematlabpixel

Matlab - How to measure the dispersion of black in a binary image?


I am comparing RGB images of small colored granules spilled randomly on a white backdrop. My current method involves importing the image into Matlab, converting to a binary image, setting a threshold and forcing all pixels above it to white. Next, I am calculating the percentage of the pixels that are black. In comparing the images to one another, the measurement of % black pixels is great; however, it does not take into account how well the granules are dispersed. Although the % black from two different images may be identical, the images may be far from being alike. For example, assume I have two images to compare. Both show a % black pixels of 15%. In one picture, the black pixels are randomly distributed throughout the image. In the other, a clump of black pixels are in one corner and are very sparse in the rest of the image.

What can I use in Matlab to numerically quantify how "spread out" the black pixels are for the purpose of comparing the two images?

I haven't been able to wrap my brain around this one yet, and need some help. Your thoughts/answers are most appreciated.


Solution

  • Found an answer to a very similar problem -> https://stats.stackexchange.com/a/13274

    Basically, you would use the average distance from a central point to every black pixel as a measure of dispersion.