Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
Sidra Aleem
Sidra Aleem le 4 Avr 2018
Commenté : Image Analyst le 6 Avr 2018
I want to highlight the region of interest using rectangular bounding box on the original image.
Can anyone here help me with this?

Réponses (1)

Image Analyst
Image Analyst le 4 Avr 2018
props = regionprops(binaryImage, 'BoundingBox');
for k = 1 : length(props)
thisBB = props(k).BoundingBox;
hold on;
rectangle('Position', thisBB);
end
  2 commentaires
Sidra Aleem
Sidra Aleem le 5 Avr 2018
Modifié(e) : Sidra Aleem le 6 Avr 2018
@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 le 6 Avr 2018
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().

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by