# How to compare the qualities of two interpolation (image resizing) algorithms?

I am implementing image resizing algorithms (Bilinear, Bicubic, Lanczos and a few others).

How do I quantitatively compare them?

I am thinking of considering a large sample of images and running these algorithms on all of them and compare pair wise wrt a standard interpolation implementation. What metric shall I use here? Any other ways of doing the same?

• Is each of your interpolation algorithms defined by a point spread function? – Olli Niemitalo Apr 29 '15 at 10:38

Usually to test interpolation algorithm (for resizing, but also rotation and all sorts of "reversible" image transforms, you would apply the forward algorithm several times (ie resize to twice the size, take the result and resize it to 1.5x the size, etc .) and then apply all the backward transformations.

The more transforms you apply the more errors you will see and the more sensitive your comparison is. It can also represent your use case better (people pick an already resized image, resize it, and publish it)

Then you compute the max difference (or the standard deviation, or just visually compare) between the result and the original image.

In your case you can also apply all the forward transforms and then resize it once to the original size.

There are many approaches to assess your resizing algorithms. Researchers typically use PSNR to compare quality of image. See http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio .

Note that, they use the same set of images as the standard. Please see http://www.hlevkin.com/ in the "test still images".

Anyway, If you want to calculate the PSNR, you need two images (Original one, and your test image). So, when you resize image with resolution a1 to a2, you have to resize it backward to original (a1). you can then evaluate it by calculating PSNR. (We generally use the same algorithm as the downsizing step to upsize (a2-->a1).)

The point is, if you want to test the downsizing algorithm alone, what is the proper method? Let's see what others have done.

• Downsizing with test algorithm and Upsizing with FIXED algorithm. (Normally be conventional e.g. Bilinear, Bicubic.)

Likewise, to work with upsizing algorihm,

• Downsizing in traditional way and then upsizing with test algorithm.
• Actually, true PSNR assessment is not possible. Starting with the test image at some resolution, you will somehow resize it to another resolution, then restore to the original resolution. Globally, what you will assess is the performance of the combined resizers, and the first one might favor an algorithm over others. – Yves Daoust Apr 29 '15 at 10:47

PSNR is not used in this resizing scenario because PSNR OR SSIM technique is used only for the same size of the images but here if we resize by using different interpolation technique the size of the image changes with respect to original image, if we again resize the resized image to the original it is also known as backlash technique,in this we cannot assess the quality because the width of the edges changes, in fact, the resized image edges width increases considerably particularly in down scaling.

As you are comparing the above mentioned methods against standard interpolation then you can use measures such as PSNR and SSIM which are available as built in function in recent versions of MATLAB distribution. Use the standard interpolation output as the reference image and use the output of the methods as target to conpute the measures.