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

9 visualizaciones (últimos 30 días)
Sidra Aleem
Sidra Aleem el 4 de Abr. de 2018
Comentada: Image Analyst el 6 de Abr. de 2018
I want to highlight the region of interest using rectangular bounding box on the original image.
Can anyone here help me with this?

Respuestas (1)

Image Analyst
Image Analyst el 4 de Abr. de 2018
props = regionprops(binaryImage, 'BoundingBox');
for k = 1 : length(props)
thisBB = props(k).BoundingBox;
hold on;
rectangle('Position', thisBB);
end
  2 comentarios
Sidra Aleem
Sidra Aleem el 5 de Abr. de 2018
Editada: Sidra Aleem el 6 de Abr. de 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 el 6 de Abr. de 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().

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by