The best way to zoom in and out

I have an image size of 300x300. And to calculate the time faster, I use downsampling it on

 I=imresize(originalImage,0.5);

After that I want to restore it

 outputImage=imresize(I,2);

But I see that the output image is not like the original image. What is the best way to try out sampling in Matlab? It will return the smallest error between the original image and the output image (after sampling down and up. Thank you so much.

+4
source share
2 answers

. , , . , , , . , , . Matlab . , downsample/upsample :

I = int8(imread('rice.png'));

J = imresize(imresize(I,0.5,'box'),2,'box');
mean(abs(J(:) - I(:)))

:

box
4.132904052734375
triangle
4.843124389648438
cubic
4.094940185546875
lanczos2
4.088195800781250
lanczos3
3.948623657226562

Lanczos3, , , . , , .

+9

( 2), impyramid:

I1 = impyramid(I0, 'reduce');
Ix = impyramid(I1, 'expand');
+2

Source: https://habr.com/ru/post/1533449/


All Articles