Enlarge the size of the image inside the plotted figure
2 views (last 30 days)
Show older comments
I have an image (defoult peppers). When I extract a portion of that picture, I display it "small". How can I keep the size of the new extracted figure with the same size as the whole image?
RGB = imread('peppers.png');
figure
imshow(RGB)
r1 = 236;
r2 = 331;
c1 = 185;
c2 = 345;
selec = RGB(r1:r2,c1:c2,:);
figure
imshow(selec);
I tried applying this code, but it only changes the size of the figure (besides the positioning).
x0=10;
y0=10;
width=550;
height=400;
set(gcf,'position',[x0,y0,width,height])
The result I would like to achieve is similar to when I perform the zoom operation.
0 Comments
Accepted Answer
Voss
on 31 Oct 2023
Here's one way:
RGB = imread('peppers.png');
figure
image(RGB)
set(gca(),'Visible','off')
r1 = 236;
r2 = 331;
c1 = 185;
c2 = 345;
selec = RGB(r1:r2,c1:c2,:);
figure
image(selec);
set(gca(),'Visible','off')
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!