How to downsize image in x and y direction?

3 ビュー (過去 30 日間)
john karli
john karli 2021 年 11 月 24 日
コメント済み: KSSV 2021 年 11 月 25 日
I have image with size 484x680 and i want to downsize with fector 2. final size should be 241x340.
i have tried it but it downsized in only one direction
img = imread('img')
new_img2 = downsample(img, 2);
I have also uplod the result of imshow(new_img2) which is img2


KSSV 2021 年 11 月 24 日
編集済み: KSSV 2021 年 11 月 24 日
Read about imresize.
img = imread('img')
new_img2 = imresize(img, 1/2);
  2 件のコメント
KSSV 2021 年 11 月 25 日
downsample skips the elements by the input N given by user. imresize does interpolation and reduces/ increases the dimensions/ size.


その他の回答 (1 件)

yanqi liu
yanqi liu 2021 年 11 月 25 日
yes, sir,may be use
clc; clear all; close all;
img = imread('');
new_img2 = img(1:2:end,1:2:end,:);

Community Treasure Hunt

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

Start Hunting!

Translated by