How to display an existing ROI on an image (Copy an ROI to another image)

10 Ansichten (letzte 30 Tage)
Hi, Guys,
I have 2 images with the same size. An ROI was drawn on 1st image. I want to display this ROI on 2nd image. The key is to display this ROI at the same location on 2nd image. Please see the following example.
% Read 1st image and display it
i1 = imread('cameraman.tif');
figure(1)
imshow(i1);
h=imellipse; % Draw ROI on 1st image
% Read 2nd image and display it
i2 = imread('cameraman.tif');
figure(2)
imshow(i2);
How to copy the ROI generated on 1st image (h) to Figure (2) and display it? Thank you!

Akzeptierte Antwort

Joseph Cheng
Joseph Cheng am 27 Mär. 2014
with the h = imellipse; you can get the points by doing
vert = getVertices(h)
figure(2),imshow(i2),hold on;
plot(vert(:,1),vert(:,2))
  3 Kommentare
Joseph Cheng
Joseph Cheng am 28 Mär. 2014
That shows most parameters you can change for your plot. Additionally you can look at the plot documentation in the link below.
plot(x,y,'--gs',...
'LineWidth',2,...
'MarkerSize',10,...
'MarkerEdgeColor','b',...
'MarkerFaceColor',[0.5,0.5,0.5])
Surya Gnyawali
Surya Gnyawali am 10 Jul. 2017
It doesnt work with imrect. Can you please explain me why?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by