Enlarge the size of the image inside the plotted figure

3 ビュー (過去 30 日間)
Alberto Acri
Alberto Acri 2023 年 10 月 31 日
回答済み: Voss 2023 年 10 月 31 日
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 Center および File ExchangeImages についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by