MATLAB Answers

Mohammed Saleh

Size Distribution code for analysis

Asked by Mohammed Saleh
on 2 Apr 2013

I have a black and white images containing different individual granules of different sizes. Is there a code to find the size distribution?. If possible, I would like to calculate the area of the individual particles in the image.

|||||Many thanks.|||||


1 Answer

Answer by Jeff EA
on 2 Apr 2013

If your "black and white" images are binary images, and you have the Image Processing Toolbox, then you can simply feed them into REGIONPROPS:

stats = regionprops(binary_image, 'Area');
granule_areas = [stats.Area];

This returns a structure, stats, which contains each object's area, which is then turned into a vector, granule_areas. At that point it's up to you to decide how you would like to calculate their distribution.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!