Enlarge the size of the image inside the plotted figure

3 次查看(过去 30 天)
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.

采纳的回答

Voss
Voss 2023-10-31
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 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by