Linear Methods for Image Interpolation
|
Prefiltering for linear interpolation. More...
#include <stdlib.h>
#include <math.h>
#include <fftw3.h>
#include "adaptlob.h"
#include "lprefilt.h"
Go to the source code of this file.
Data Structures | |
struct | convolutionparams |
Functions | |
void | PrefilterImage (float *Data, int Width, int Height, int NumChannels, const float *alpha, int NumFilterPairs, float ConstantFactor, boundaryhandling Boundary) |
Apply a cascade of first-order recursive filter pairs to an image. More... | |
void | PsfConvCoeff (float *Coeff, int NumCoeffs, float(*Psf)(float, const void *), const void *PsfParams, float(*Kernel)(float), float KernelRadius, int KernelNormalize) |
Compute PSF*kernel convolution coefficients. More... | |
int | PsfPreFilter (float *Data, int Width, int Height, int NumChannels, const float *Coeff, int NumCoeffs, boundaryhandling Boundary) |
Prefiltering to adjust interpolation for PSF. More... | |
Prefiltering for linear interpolation.
This file implements the prefiltering PrefilterImage
on the input image needed before performing interpolation needed with B-splines and o-Moms. Also implemented here is PsfPreFilter
, the prefiltering adjustment needed when interpolating with a PSF.
Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.
This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.
Definition in file lprefilt.c.
void PrefilterImage | ( | float * | Data, |
int | Width, | ||
int | Height, | ||
int | NumChannels, | ||
const float * | alpha, | ||
int | NumFilterPairs, | ||
float | ConstantFactor, | ||
boundaryhandling | Boundary | ||
) |
Apply a cascade of first-order recursive filter pairs to an image.
Data | the image data |
Width,Height,NumChannels | image dimensions |
alpha | array of alpha values |
NumFilterPairs | the number of filter pairs |
ConstantFactor | constant multiplicative factor to apply |
Boundary | the kind of boundary handling to use |
Definition at line 132 of file lprefilt.c.
void PsfConvCoeff | ( | float * | Coeff, |
int | NumCoeffs, | ||
float(*)(float, const void *) | Psf, | ||
const void * | PsfParams, | ||
float(*)(float) | Kernel, | ||
float | KernelRadius, | ||
int | KernelNormalize | ||
) |
Compute PSF*kernel convolution coefficients.
Coeff | pointer to coefficients destination array |
NumCoeffs | number of coefficients to compute |
Psf | the point-spread function (PSF) |
PsfParams | parameters to pass to Psf |
Kernel | the interpolation kernel or basis function to use |
KernelRadius | support radius of Kernel |
KernelNormalize | if nonzero, Kernel is normalized to sum to 1 |
The coefficients are the convolution Coeff[m] = (Psf * Kernel)(m) for m = 0, ..., NumCoeffs - 1. Integration is approximated using adaptive Gauss-Lobatto quadrature.
The result of this routine is used by PsfPreFilter
.
Definition at line 214 of file lprefilt.c.
int PsfPreFilter | ( | float * | Data, |
int | Width, | ||
int | Height, | ||
int | NumChannels, | ||
const float * | Coeff, | ||
int | NumCoeffs, | ||
boundaryhandling | Boundary | ||
) |
Prefiltering to adjust interpolation for PSF.
Data | pointer to image data to be filtered |
Width,Height,NumChannels | image dimensions |
Coeff | the PSF adjustment coefficients from PsfConvCoeff |
NumCoeffs | number of coefficients |
Boundary | boundary handling |
Convolves Data with the inverse of Coeff[0] + Coeff[1] (z + z^-1) + Coeff[2] (z^2 + z^-2) + ... via the DCT transform. Boundary handling can be either half- or whole- sample symmetric (constant extension is not supported).
Half-sample symmetric boundary handling is considerably more efficient, about 25% shorter runtime than when using whole-sample symmetry.
Definition at line 380 of file lprefilt.c.