The images below have been reduced in size by the indicated factors.
full size | 2 x 2 | 3 x 3 | 4 x 4 |
source code: reduce.cpp
Sampling reduces the size of an image by extracting pixels on a periodic sample grid, every 3th pixel in every 3th row, for example.
Sampling produces a different reduced image than averaging, especially in patterned regions. Compare the hat and hair in the examples below.
averaged | sampled |
source code: subsamp.cpp
The images above have been restored to full size by pixel replication. Each image is labeled by its pixel block size
1 x 1 | 2 x 2 | 3 x 3 | 4 x 4 |
source code: dupl.cpp
The original image below was reduced in size by 4 x 4 and then restored to full size, first by bilinear interpolation then by pixel replication.
original | bilinear | pixel replication |
source code: resize.cpp
B = IMRESIZE(A,M,'method') returns an image matrix that is M times larger (or smaller) than the image A. The image B is computed by interpolating using the method in the string 'method'. Possible methods are
reference: imresize.m
>> img = imread('pens.tif'); >> whos Name Size Bytes Class img 480x512x3 737280 uint8 array >> z1 = imresize(img,1/3.0,'bicubic'); >> imshow(z1); >> tiffwrite(z1,'pens1.tif');
>> z3 = imcrop; >> imshow(z3); >> tiffwrite(z3,'pens3.tif');
>> z4 = imresize(z3,3.25,'bilinear'); >> imshow(z4); >> tiffwrite(z4,'pens4.tif');
Maintained by John Loomis, last updated July 9, 1997