3-d plot

I have two matrixes: I is a grayscale image and BW is the binary image. for the regions that have area>50 in BW, I want to calculate the mean value of the those regions in I. I then want to show these mean values for each region as bar plot on the grayscale. Any suggestion?
I used the following code to show the mean value of each region on the image but dont know how to show them as bar.
% create a synthetic image
I = propsSynthesizeImage;
%a create binary image
BW = I >0;
%find the centroid of each region
s = regionprops(BW, I, {'Centroid'});
imshow(I)
title('Weighted (red) and Unweighted (blue) Centroid Locations');
hold on
numObj = numel(s);
%plot the centeroid of each region on the image
for k = 1 : numObj
plot(s(k).Centroid(1), s(k).Centroid(2), 'bo');
end
hold off
s = regionprops(BW, I, {'Centroid', 'PixelValues', 'BoundingBox'});
imshow(I);
title('Standard Deviation of Regions');
hold on
%calculate the mean value of each region and plot them on the image
for k = 1 : numObj
s(k).Mean= mean(double(s(k).PixelValues));
text(s(k).Centroid(1),s(k).Centroid(2), ...
sprintf('%2.1f', s(k).Mean), ...
'EdgeColor','b','Color','r');
end
hold off

댓글 수: 2

Walter Roberson
Walter Roberson 2011년 12월 17일
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Hassan
Hassan 2011년 12월 17일
thanks Walter for the command. I did some changes in the format but Im not sure if they were what you meant.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2011년 12월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by