Enlarge the size of the image inside the plotted figure

3 visualizaciones (últimos 30 días)
Alberto Acri
Alberto Acri el 31 de Oct. de 2023
Respondida: Voss el 31 de Oct. de 2023
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.

Respuesta aceptada

Voss
Voss el 31 de Oct. de 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')

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by