Comparison of mean signal using RegioProps versus Binary mask

7 views (last 30 days)
I have an image that I have transferred the results from region props to identify the light fluorescent objects. I want to obtain the mean of this signal. I have attempted two ways and get different answers.
The image showing the result of a regionprops applied to a binary Image
This is the RegioProps way:
%DrawRegions from Binary to raw image:
labeledImage = bwlabel(Binary, 8); % Label each blob so we can make measurements of it
blobMeasurements = regionprops(labeledImage, ROI, 'all'); %ROI is original image
numberOfBlobs = size(blobMeasurements, 1);
hold on;
boundaries = bwboundaries(Binary);
numberOfBoundaries = size(boundaries);
subplot(4,5,[1,2,6,7])
hold on
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 1);
end
hold off;
%Get mean intensity of foreground by blobmeasurements
allBlobIntensities = [blobMeasurements.MeanIntensity]
meanI=mean(allBlobIntensities(:))
which gives a mean of 4357 counts.
Using the Binary image used above to act as a mask on the raw Image:
%Now by Binary mask
IM=ROI; %Assign original image to IM
Binary=logical(Binary);
IM(~Binary)=0
meanI2=mean(IM(:))
This gives a mean of 2295
??? Have I made an error?
Thanks Jason

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!