필터 지우기
필터 지우기

How to draw bounding boxes around the ROI obtained by thresholding.

조회 수: 3 (최근 30일)
Sidra Aleem
Sidra Aleem 2018년 4월 4일
댓글: Image Analyst 2018년 4월 6일
I want to highlight the region of interest using rectangular bounding box on the original image.
Can anyone here help me with this?

답변 (1개)

Image Analyst
Image Analyst 2018년 4월 4일
props = regionprops(binaryImage, 'BoundingBox');
for k = 1 : length(props)
thisBB = props(k).BoundingBox;
hold on;
rectangle('Position', thisBB);
end
  댓글 수: 2
Sidra Aleem
Sidra Aleem 2018년 4월 5일
편집: Sidra Aleem 2018년 4월 6일
@Image Analyst I tried the same code from the link ( https://de.mathworks.com/matlabcentral/answers/87597-rectangle-around-the-object-bounding-box ). but its gives bounding boxes in the thresholded image.
However, I donot want this. I want these bouding boxes at the same position, but on the segmented image as shown in figure1 in my questionj. I want the bounding box around the thresholded image to be in the same position, but on Blood vessel subplot.
I tried to do the following, but its not working.
st = regionprops(Thresholded_image,'BoundingBox'); % Thresholded image in subplot 2
figure,imshow(bloodVessels); %Blood Vessel Image in subplot 3
for k = 1 : length(st)
thisBB = st(k).BoundingBox;
rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...
'EdgeColor','r','LineWidth',2 )
end
As shown the third subplot doesnot have any bounding box.
Image Analyst
Image Analyst 2018년 4월 6일
You have to switch the current axes to the one you want to put the boxes onto. For example call subplot() or axes() before you call rectangle().

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

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by