torch/image — pull request #3 by jonathantompson (2013-09-24 21:33:53+00:00)
Title: added bicubic and lanczos filtering for image.warp function.

I added bicubic and lanczos interpolation options to image.warp. I wanted to perform high quality image rotations and upscaling... Bilinear interpolation tends to over filter, resulting in slightly blurry rotation images. Lanczos is near perfect (but slow) and bicubic is a pretty good tradeoff between quality and speed.

I also added a test script (test_warp.lua) to show the difference between each of the methods, however lena is not a great test image for this sort of comparison. The difference is much easier to see on synthetic images with sharp edges.

image.warp using bicubic iterpolation is about 2.3x slower than bilinear (but uses 16 samples per interpolation, instead of 4 so this is reasonable).

Lanczos interpolation is about 21x slower than bilinear (but it needs to perform a 7 x 7 non-separable convolution on each pixel... and even worse, the kernel is not constant and has to be re-computed on every pixel output).

Let me know if you have any questions / issues...