How can I fill in the red regions in the image below given by:
%DrawRegions from Binary onto raw image:
labeledImage = bwlabel(Back, 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(Back);
numberOfBoundaries = size(boundaries);
subplot(4,5,[1,2,6,7])
hold on
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'r.', 'LineWidth', 1);
end
hold off;
i.e. the red boundaries in the image.

댓글 수: 4

Mohammad Abouali
Mohammad Abouali 2015년 1월 15일
편집: Mohammad Abouali 2015년 1월 15일
What do you want to fill it with?
And a side question, the red region apparently comes from the bwlabel of Back. Isn't Back already filled red region then?
Jason
Jason 2015년 1월 15일
편집: Jason 2015년 1월 15일
Hi. I want everything inside the red region to be red. Back is binary image representing my calc of background. I then transfer this these regions on the original gray image
Pete sherer
Pete sherer 2015년 9월 25일
any solutions to this? I am trying to do the same
Image Analyst
Image Analyst 2015년 9월 25일
Mohammad's code worked for Jason. Doesn't it work for you? If not, post your image and code in a new question.

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

 채택된 답변

Mohammad Abouali
Mohammad Abouali 2015년 1월 15일
편집: Mohammad Abouali 2015년 1월 15일

1 개 추천

Ok, but the red lines is pretty much the boundary of the regions in the binary image stored in the variable called back, right?
If that is the case, and assuming your raw-image is a one layer gray scale image, i.e. size of raw_image is NxMx1 (based on your past posts then 101x101) then here is what you should do
RGB(:,:,1)=min(double(Back)+double(raw_image)./max(double(raw_image(:))),1);
RGB(:,:,2)=double(raw_image)./max(double(raw_image(:)));
RGB(:,:,3)=double(raw_image)./max(double(raw_image(:)));
Of course Back needs to be the same size as of raw_image.

추가 답변 (0개)

질문:

2015년 1월 15일

댓글:

2015년 9월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by