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);
imshow(new_img2)
I have also uplod the result of imshow(new_img2) which is img2

채택된 답변

KSSV
KSSV 2021년 11월 24일
편집: KSSV 2021년 11월 24일
Read about imresize.
img = imread('img')
new_img2 = imresize(img, 1/2);
imshow(new_img2)
  댓글 수: 2
john karli
john karli 2021년 11월 24일
is downsampling and imresize are same ?
KSSV
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('https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/811604/img1.png');
new_img2 = img(1:2:end,1:2:end,:);
imshow(new_img2)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by