How to display an existing ROI on an image (Copy an ROI to another image)
8 views (last 30 days)
Show older comments
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!

0 Comments
Accepted Answer
Joseph Cheng
on 27 Mar 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 Comments
Joseph Cheng
on 28 Mar 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])
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!