The 'REGIONPROPS' or 'REGIONPROPS3' command from the Image Processing Toolbox can calculate the minimum, maximum, and average intensity of regions. You can use 'regionprops()'/'regionprops3()'/ function and ask for the mean intensity of all the blobs by setting the 'Pixel Value Measurements' property or the 'Voxel Value Measurements' property respectively.
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, grayscaleImage, 'MeanIntensity');
OR, measurements = regionprops3(labeledImage, grayscaleImage, 'MeanIntensity');
For more information on the REGIONPROPS/REGIONPROPS3 function, type
doc regionprops
doc regionprops3
at the MATLAB Command Window, or go to these documentation links:
- https://www.mathworks.com/help/images/ref/regionprops.html
- https://www.mathworks.com/help/images/ref/regionprops3.html
DISCLAIMER: These are my own views and in no way depict those of MathWorks.