MATLAB Answers

Resampling and quantization of image.

8 views (last 30 days)
Muhammad Usman
Muhammad Usman on 23 Sep 2021 at 3:09
Answered: yanqi liu on 28 Sep 2021 at 7:50
If the size of width and height of image are different, how to to resampling and quantization?

Answers (2)

Image Analyst
Image Analyst on 23 Sep 2021 at 3:33
You can use imresize() and specify either a saling equally in both directions, or you can specify the exact number of rows and columns you want the output image to have.

yanqi liu
yanqi liu on 28 Sep 2021 at 7:50
clc; clear all; close all;
im = imread('football.jpg');
% make the same
wh = min([size(im,1) size(im, 2)]);
im2 = imresize(im, [wh wh], 'bilinear');
figure;
montage({im,im2}, 'Size', [1 2], 'BackgroundColor', 'c', 'BorderSize', [3 3])
size(im2)
ans = 1×3
256 256 3

Community Treasure Hunt

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

Start Hunting!

Translated by