Functions
core/vil/vil_nearest_interp.h File Reference

nearest neighbour interpolation functions for 2D images More...

#include <vcl_cassert.h>
#include <vcl_cstddef.h>
#include <vil/vil_fwd.h>

Go to the source code of this file.

Functions

template<class T >
vil_nearest_interp_unsafe (double x, double y, const T *data, int, int, vcl_ptrdiff_t xstep, vcl_ptrdiff_t ystep)
 Compute nearest neighbour interpolation at (x,y), no bound checks. Requires -0.5<x<ni-0.5, -0.5<y<nj-0.5.
template<class T >
vil_nearest_interp_unsafe (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute nearest neighbour interpolation at (x,y), no bound checks. Requires -0.5<=x<ni-0.5, -0.5<=y<nj-0.5.
template<class T >
vil_nearest_interp_safe (double x, double y, const T *data, int nx, int ny, vcl_ptrdiff_t xstep, vcl_ptrdiff_t ystep)
 Compute nearest neighbour interpolation at (x,y), with bound checks.
template<class T >
vil_nearest_interp_safe (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute nearest neighbour interpolation at (x,y), with bound checks.
template<class T >
vil_nearest_interp (double x, double y, const T *data, int nx, int ny, vcl_ptrdiff_t xstep, vcl_ptrdiff_t ystep)
 Compute nearest neighbour interpolation at (x,y), with minimal bound checks.
template<class T >
vil_nearest_interp (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute nearest neighbour interpolation at (x,y), with minimal bound checks.
template<class T >
vil_nearest_interp_safe_extend (double x, double y, const T *data, int nx, int ny, vcl_ptrdiff_t xstep, vcl_ptrdiff_t ystep)
 Compute nearest neighbour interpolation at (x,y), with bound checks.
template<class T >
vil_nearest_interp_safe_extend (const vil_image_view< T > &view, double x, double y, unsigned p=0)
 Compute nearest neighbour interpolation at (x,y), with bound checks.

Detailed Description

nearest neighbour interpolation functions for 2D images

Author:
Ian Scott

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

Definition in file vil_nearest_interp.h.


Function Documentation

template<class T >
T vil_nearest_interp ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
vcl_ptrdiff_t  xstep,
vcl_ptrdiff_t  ystep 
) [inline]

Compute nearest neighbour 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.5,view.ni()-0.5)*[0.5,view.nj()-0.5).

Definition at line 78 of file vil_nearest_interp.h.

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

Compute nearest neighbour 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.5,view.ni()-0.5)*[0.5,view.nj()-0.5).

Definition at line 98 of file vil_nearest_interp.h.

template<class T >
T vil_nearest_interp_safe ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
vcl_ptrdiff_t  xstep,
vcl_ptrdiff_t  ystep 
) [inline]

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

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

Definition at line 46 of file vil_nearest_interp.h.

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

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

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

Definition at line 64 of file vil_nearest_interp.h.

template<class T >
T vil_nearest_interp_safe_extend ( double  x,
double  y,
const T *  data,
int  nx,
int  ny,
vcl_ptrdiff_t  xstep,
vcl_ptrdiff_t  ystep 
) [inline]

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

Image is nx * ny array of Ts. x,y element is data[ystep*y+xstep*x] If (x,y) is outside safe interpolatable image region, nearest pixel value is returned. The safe interpolatable region is [-0.5,view.ni()-0.5)*[-0.5,view.nj()-0.5).

Definition at line 111 of file vil_nearest_interp.h.

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

Compute nearest neighbour 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.5,view.ni()-0.5)*[-0.5,view.nj()-0.5).

Definition at line 136 of file vil_nearest_interp.h.

template<class T >
T vil_nearest_interp_unsafe ( double  x,
double  y,
const T *  data,
int  ,
int  ,
vcl_ptrdiff_t  xstep,
vcl_ptrdiff_t  ystep 
) [inline]

Compute nearest neighbour interpolation at (x,y), no bound checks. Requires -0.5<x<ni-0.5, -0.5<y<nj-0.5.

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

Definition at line 23 of file vil_nearest_interp.h.

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

Compute nearest neighbour interpolation at (x,y), no bound checks. Requires -0.5<=x<ni-0.5, -0.5<=y<nj-0.5.

No bound checks are done.

Definition at line 37 of file vil_nearest_interp.h.