Functions
vil_bilin_interp.h File Reference

Bilinear interpolation functions for 2D images. More...

#include <cstddef>
#include <cassert>
#include <vil/vil_image_view.h>
#include <vil/vil_na.h>

Go to the source code of this file.

Functions

template<class T >
double vil_bilin_interp_unsafe (double x, double y, const T *data, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), no bound checks. Requires 0<x<ni-2, 0<y<nj-2. More...
 
template<class T >
double vil_bilin_interp_unsafe (double x, double y, const T *data, int, int, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), no bound checks. Requires 0<x<ni-2, 0<y<nj-2. More...
 
template<class T >
double vil_bilin_interp_raw (double x, double y, const T *data, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), no bound checks. More...
 
template<class T >
double vil_bilin_interp_raw (double x, double y, const T *data, int, int, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), no bound checks. More...
 
template<class T >
double vil_bilin_interp_safe (double x, double y, const T *data, int nx, int ny, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), with bound checks. More...
 
template<class T >
double vil_bilin_interp_safe_edgena (double x, double y, const T *data, int nx, int ny, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), with bound checks. More...
 
template<class T >
double vil_bilin_interp_safe (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute bilinear interpolation at (x,y), with bound checks. More...
 
template<class T >
double vil_bilin_interp_safe_edgena (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute bilinear interpolation at (x,y), with bound checks. More...
 
template<class T >
double vil_bilin_interp (double x, double y, const T *data, int nx, int ny, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), with minimal bound checks. More...
 
template<class T >
double vil_bilin_interp (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute bilinear interpolation at (x,y), with minimal bound checks. More...
 
template<class T >
double vil_bilin_interp_safe_extend (double x, double y, const T *data, int nx, int ny, std::ptrdiff_t xstep, std::ptrdiff_t ystep)
 Compute bilinear interpolation at (x,y), with bound checks. More...
 
template<class T >
double vil_bilin_interp_safe_extend (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute bilinear interpolation at (x,y), with bound checks. More...
 

Detailed Description

Bilinear interpolation functions for 2D images.

Author
Tim Cootes

The vil bicub source files were derived from the corresponding vil bilin files, thus the vil bilin/bicub source files are very similar. If you modify something in this file, there is a corresponding bicub file that would likely also benefit from the same change.

Definition in file vil_bilin_interp.h.

Function Documentation

◆ vil_bilin_interp() [1/2]

template<class T >
double vil_bilin_interp ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), with minimal bound checks.

Image is nx * ny array of Ts. x,y element is data[ystep*y+xstep*x] If (x,y) is outside interpolatable image region and NDEBUG is not defined the code will fail an ASSERT. The safe interpolatable region is [0,nx-1]*[0,ny-1].

Definition at line 159 of file vil_bilin_interp.h.

◆ vil_bilin_interp() [2/2]

template<class T >
double vil_bilin_interp ( const vil_image_view< T > &  view,
double  x,
double  y,
unsigned  p = 0 
)
inline

Compute bilinear interpolation at (x,y), with minimal bound checks.

If (x,y) is outside interpolatable image region and NDEBUG is not defined the code will fail an ASSERT. The safe interpolatable region is [0,view.ni()-1]*[0,view.nj()-1].

Definition at line 176 of file vil_bilin_interp.h.

◆ vil_bilin_interp_raw() [1/2]

template<class T >
double vil_bilin_interp_raw ( double  x,
double  y,
const T *  data,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), no bound checks.

Image is nx * ny array of Ts. x,y element is data[xstep*x+ystep*y] No bound checks are done.

Definition at line 61 of file vil_bilin_interp.h.

◆ vil_bilin_interp_raw() [2/2]

template<class T >
double vil_bilin_interp_raw ( double  x,
double  y,
const T *  data,
int  ,
int  ,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), no bound checks.

Image is nx * ny array of Ts. x,y element is data[xstep*x+ystep*y] No bound checks are done. This is a version of vil_bilin_interp_raw with the same function signature as vil_bilin_interp_safe.

Definition at line 89 of file vil_bilin_interp.h.

◆ vil_bilin_interp_safe() [1/2]

template<class T >
double vil_bilin_interp_safe ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), with bound checks.

Image is nx * ny array of Ts. x,y element is data[xstep*x+ystep*y] If (x,y) is outside interpolatable image region, zero is returned. The safe interpolatable region is [0,nx-1]*[0,ny-1].

Definition at line 101 of file vil_bilin_interp.h.

◆ vil_bilin_interp_safe() [2/2]

template<class T >
double vil_bilin_interp_safe ( const vil_image_view< T > &  view,
double  x,
double  y,
unsigned  p = 0 
)
inline

Compute bilinear interpolation at (x,y), with bound checks.

If (x,y) is outside interpolatable image region, zero is returned. The safe interpolatable region is [0,view.ni()-1]*[0,view.nj()-1].

Definition at line 131 of file vil_bilin_interp.h.

◆ vil_bilin_interp_safe_edgena() [1/2]

template<class T >
double vil_bilin_interp_safe_edgena ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), with bound checks.

Image is nx * ny array of Ts. x,y element is data[xstep*x+ystep*y] If (x,y) is outside interpolatable image region, NA is returned. The safe interpolatable region is [0,nx-1]*[0,ny-1].

Definition at line 118 of file vil_bilin_interp.h.

◆ vil_bilin_interp_safe_edgena() [2/2]

template<class T >
double vil_bilin_interp_safe_edgena ( const vil_image_view< T > &  view,
double  x,
double  y,
unsigned  p = 0 
)
inline

Compute bilinear interpolation at (x,y), with bound checks.

If (x,y) is outside interpolatable image region, NA is returned. The safe interpolatable region is [0,view.ni()-1]*[0,view.nj()-1].

Definition at line 145 of file vil_bilin_interp.h.

◆ vil_bilin_interp_safe_extend() [1/2]

template<class T >
double vil_bilin_interp_safe_extend ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), with bound checks.

Image is nx * ny array of Ts. x,y element is data[nx*y+x] If (x,y) is outside safe interpolatable image region, nearest pixel value is returned. The safe interpolatable region is [0,nx-1]*[0,ny-1].

Definition at line 190 of file vil_bilin_interp.h.

◆ vil_bilin_interp_safe_extend() [2/2]

template<class T >
double vil_bilin_interp_safe_extend ( const vil_image_view< T > &  view,
double  x,
double  y,
unsigned  p = 0 
)
inline

Compute bilinear interpolation at (x,y), with bound checks.

If (x,y) is outside safe interpolatable image region, nearest pixel value is returned. The safe interpolatable region is [0,view.ni()-1]*[0,view.nj()-1].

Definition at line 206 of file vil_bilin_interp.h.

◆ vil_bilin_interp_unsafe() [1/2]

template<class T >
double vil_bilin_interp_unsafe ( double  x,
double  y,
const T *  data,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), no bound checks. Requires 0<x<ni-2, 0<y<nj-2.

Image is nx * ny array of Ts. x,y element is data[xstep*x+ystep*y] No bound checks are done.

Definition at line 27 of file vil_bilin_interp.h.

◆ vil_bilin_interp_unsafe() [2/2]

template<class T >
double vil_bilin_interp_unsafe ( double  x,
double  y,
const T *  data,
int  ,
int  ,
std::ptrdiff_t  xstep,
std::ptrdiff_t  ystep 
)
inline

Compute bilinear interpolation at (x,y), no bound checks. Requires 0<x<ni-2, 0<y<nj-2.

Image is nx * ny array of Ts. x,y element is data[xstep*x+ystep*y] No bound checks are done. This is a version of vil_bilin_interp_unsafe with the same function signature as vil_bilin_interp_safe.

Definition at line 50 of file vil_bilin_interp.h.