Thursday, June 5, 2008

Assignment 7 - Comments and Method 4

Method 4 - Bicubic interpolation and comparison of methods

According to the textbook (p. 66), this method is preferred over the bilinear interpolation method since it "does a better job of preserving fine detail". In fact, Matlab uses bicubic interpolation as its default method for the built-in image size reduction function. Also, as the textbook notes, bicubic interpolation is the method used in commerical image editing programs like Photoshop (and presumably GIMP).

However, since bicubic interpolation involves using the 16 nearest neighbours of a point (x, y) to determine the intensity value at (i, j) on the smaller image, the computation time is slower when compared with the bilinear interpolation and nearest neighbour methods. Several websites also describe complications with how to handle the edge/border points when writing programs using bicubic interpolation, so I won't be attempting this. But for illustration purposes, I will use Matlab's imresize function (which by default is using bicubic interpolation) to compare the quality of images using the different methods.


Here's what Matlab says about methods 2, 3 and 4 (apparently, method 1 is so terrible that nobody else seems to mention this method):


Nearest-neighbor interpolation: the output pixel is assigned the value of the pixel that the point falls within. No other pixels are considered. This is the fastest method, but has the lowest quality.

Bilinear interpolation: the output pixel value is a weighted average of pixels in the nearest 2-by-2 neighborhood

Bicubic interpolation: the output pixel value is a weighted average of pixels in the nearest 4-by-4 neighborhood. This is the slowest method, but has the highest quality.


Looking at some images: These use scale factor f=0.75














1) Method 1: Averaging












2) Method 2: Nearest Neighbour (using my commands)










3) Method 3: Bilinear interpolation (using my commands)










Based on these images, it seems as though method 3 preserves the most detail from the original image, and method 1 the least.

4) Method 4: Bicubic interpolation (using Matlab's imresize function)















It's a bit hard to compare these images because of the scaling on the ones created using my commands. Here is a more direct comparison of the methods using imresize for methods 2, 3 and 4 (with f = 0.25):








































It seems that both bilinear and bicubic provide images that are closer to the original than the nearest neighbour method, with bicubic a bit better than bilinear.

No comments: