Enlarge the size of the image inside the plotted figure

3 vues (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 31 Oct 2023
Réponse apportée : Voss le 31 Oct 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.

Réponse acceptée

Voss
Voss le 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')

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by