Draw rectangle in subplot image.

조회 수: 9 (최근 30일)
Sunil  Shahi
Sunil Shahi 2013년 7월 14일
I have images say I1 and I2 in matrix form say I make a subplots to have them both in same figure. now I have to draw few rectangle on top of these images. how can I draw a rectangle in a specific subplot?
%this draws rectangle on top of I1
imshow(I1, [])
rectangle('Position',[x,y,w,h])
%somewhere else after the above code
%this draws the rectangle on top of I2
imshoe(I2, [])
rectangle('Position',[x,y,w,h])
now I want to draw rectangles on top of I1 what should I do?

채택된 답변

Image Analyst
Image Analyst 2013년 7월 14일
%this draws rectangle on top of I1
subplot(1, 2, 1); % Focus is with axes #1.
imshow(I1, [])
rectangle('Position',[x,y,w,h])
%somewhere else after the above code
%this draws the rectangle on top of I2
subplot(1, 2, 2); % Focus is with axes #2.
imshow(I2, [])
rectangle('Position',[x,y,w,h])
% Back to #1 now.
%this draws rectangle on top of I1
subplot(1, 2, 1); % Focus is with axes #1.
rectangle('Position',[x,y,w,h])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by