Image processing algorithms, template matching techniques included, often require image scaling and rotation. These operations are a subset of the linear transformations described by Equation TM:2.74. As an illustrative example let us consider geometric normalization of a face image: a combined rotation, scaling, and translation operation fixing the origin of the image coordinate system at the midpoint of the segment joining the eyes, at the same time making the eye to eye axis horizontal with eyes at a predefined distance from the new origin.
Image transformations of the type considered usually require image values at positions different from those of the original sampling. The computation of the new values can be performed correctly if the requirements of the sampling theorem are satisfied, sometimes requiring a preliminary smoothing step in order to reduce image frequency content, e.g. when reducing image size. The actual resampling operation can then be performed relying on Lanczos interpolation.
The frequency conditioning step can be performed applying a Gaussian
smoothing kernel or a Lanczos kernel. Let us consider halving image
resolution. As the Gaussian filter is approximately band limited with
critical spacing 48#48 and corresponding bad-limit
49#49,
it is appropriate to smooth the image with a 50#50 Gaussian
kernel (as we want to halve its resolution. If we use a Lanczos kernel
we can rely on Equations TM:2.77-78 and sample the original kernel
(twice) more densely. A function is available for computing the
kernel, tm.lanczosKernel: the sampling density of the kernel is
controlled by parameter factor.
51#51
If trim is omitted (or set to TRUE) the size of the
kernel is appropriately computed to cover its support. Kernel
lk22 is the one to use in preconditioning image frequency
content prior to subsampling.
[width=8cm]figures/lanczosKernels.jpg |
52#52
[width=8cm]figures/normalized1.jpg
[width=8cm]figures/normalized2.jpg |