How to draw a rectangle on a image?

I am trying to draw a rectangle on a image.
box =[100 200 200 200]
im=imread(im); figure, imshow(im)
hold on rectange = rectangle('Position', box, 'FaceColor','k')
Everytime the image gets displayed but without the rectangle. Please help me.

답변 (1개)

DGM
DGM 2023년 3월 21일

0 개 추천

I'm going to guess that whatever the image was, it was either too small for the specified rectangle to be in-frame, or it was large, and the rectangle was being placed in a dark region.
box =[100 200 100 100];
im=imread('peppers.png');
imshow(im)
hold on
rectangle('Position', box, 'FaceColor','k')

카테고리

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

질문:

2015년 6월 11일

답변:

DGM
2023년 3월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by