Macros | Functions
vil_gauss_reduce.hxx File Reference

Functions to smooth and sub-sample image in one direction. More...

#include "vil_gauss_reduce.h"
#include <cassert>
#include <vil/vil_bilin_interp.h>
#include <vil/vil_plane.h>
#include <vil/vil_convert.h>

Go to the source code of this file.

Macros

#define VIL_GAUSS_REDUCE_INSTANTIATE(T)
 

Functions

template<class T >
void vil_gauss_reduce (const vil_image_view< T > &src_im, vil_image_view< T > &dest_im, vil_image_view< T > &work_im)
 Smooth and subsample src_im to produce dest_im. More...
 
template<class T >
void vil_gauss_reduce_2_3 (const vil_image_view< T > &src_im, vil_image_view< T > &dest_im, vil_image_view< T > &work_im)
 Smooth and subsample src_im to produce dest_im (2/3 size). More...
 
template<class T >
void vil_gauss_reduce_121 (const vil_image_view< T > &src_im, vil_image_view< T > &dest_im)
 Smooth and subsample src_im to produce dest_im. More...
 
unsigned char rl_round (double x, unsigned char)
 An optimisable rounding function. More...
 
signed char rl_round (double x, signed char)
 
unsigned short rl_round (double x, unsigned short)
 
signed short rl_round (double x, signed short)
 
unsigned int rl_round (double x, unsigned int)
 
signed int rl_round (double x, signed int)
 
unsigned long rl_round (double x, unsigned long)
 
signed long rl_round (double x, signed long)
 
double rl_round (double x, double)
 
float rl_round (double x, float)
 
template<class T >
void vil_gauss_reduce_general_plane (const vil_image_view< T > &src, vil_image_view< T > &dest, vil_image_view< T > &worka, vil_image_view< T > &workb, const vil_gauss_reduce_params &params)
 Smooth and subsample src_im to produce dest_im. More...
 
template<class T >
void vil_gauss_reduce_general (const vil_image_view< T > &src, vil_image_view< T > &dest, vil_image_view< T > &worka, vil_image_view< T > &workb, const vil_gauss_reduce_params &params)
 Smooth and subsample src_im by an arbitrary factor to produce dest_im. More...
 
template<class T >
void vil_gauss_reduce_1plane (const T *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, T *dest_im, std::ptrdiff_t d_x_step, std::ptrdiff_t d_y_step)
 Smooth and subsample single plane src_im in x to produce dest_im. More...
 
template<class T >
void vil_gauss_reduce_121_1plane (const T *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, T *dest_im, std::ptrdiff_t d_x_step, std::ptrdiff_t d_y_step)
 Smooth and subsample single plane src_im in x to produce dest_im using 121 filter in x and y. More...
 
template<class T >
void vil_gauss_reduce_2_3_1plane (const T *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, T *dest_im, std::ptrdiff_t d_x_step, std::ptrdiff_t d_y_step)
 Smooth and subsample single plane src_im in x, result is 2/3rd size. More...
 

Detailed Description

Functions to smooth and sub-sample image in one direction.

Author
Tim Cootes

Definition in file vil_gauss_reduce.hxx.

Macro Definition Documentation

◆ VIL_GAUSS_REDUCE_INSTANTIATE

#define VIL_GAUSS_REDUCE_INSTANTIATE (   T)
Value:
template void vil_gauss_reduce(const vil_image_view<T >& src, \
vil_image_view<T >& work_im); \
template void vil_gauss_reduce_2_3(const vil_image_view<T >& src, \
vil_image_view<T >& work_im); \
template void vil_gauss_reduce_121(const vil_image_view<T >& src, \
template void vil_gauss_reduce_general(const vil_image_view<T >& src_im, \
vil_image_view<T >& dest_im, \
const vil_gauss_reduce_params& params)
void vil_gauss_reduce_general(const vil_image_view< T > &src_im, vil_image_view< T > &dest_im, const vil_gauss_reduce_params &params)
Smooth and subsample src_im by an arbitrary factor to produce dest_im.
Concrete view of image data of type T held in memory.
Definition: vil_fwd.h:13
void vil_gauss_reduce_121(const vil_image_view< T > &src, vil_image_view< T > &dest)
Smooth and subsample src_im to produce dest_im.
void vil_gauss_reduce_2_3(const vil_image_view< T > &src_im, vil_image_view< T > &dest_im, vil_image_view< T > &work_im)
Smooth and subsample src_im to produce dest_im (2/3 size).
void vil_gauss_reduce(const vil_image_view< T > &src, vil_image_view< T > &dest, vil_image_view< T > &work_im)
Smooth and subsample src_im to produce dest_im.

Definition at line 466 of file vil_gauss_reduce.hxx.

Function Documentation

◆ rl_round() [1/10]

unsigned char rl_round ( double  x,
unsigned char   
)
inline

An optimisable rounding function.

Definition at line 123 of file vil_gauss_reduce.hxx.

◆ rl_round() [2/10]

signed char rl_round ( double  x,
signed char   
)
inline

Definition at line 126 of file vil_gauss_reduce.hxx.

◆ rl_round() [3/10]

unsigned short rl_round ( double  x,
unsigned short   
)
inline

Definition at line 129 of file vil_gauss_reduce.hxx.

◆ rl_round() [4/10]

signed short rl_round ( double  x,
signed short   
)
inline

Definition at line 132 of file vil_gauss_reduce.hxx.

◆ rl_round() [5/10]

unsigned int rl_round ( double  x,
unsigned int   
)
inline

Definition at line 135 of file vil_gauss_reduce.hxx.

◆ rl_round() [6/10]

signed int rl_round ( double  x,
signed int   
)
inline

Definition at line 138 of file vil_gauss_reduce.hxx.

◆ rl_round() [7/10]

unsigned long rl_round ( double  x,
unsigned long   
)
inline

Definition at line 141 of file vil_gauss_reduce.hxx.

◆ rl_round() [8/10]

signed long rl_round ( double  x,
signed long   
)
inline

Definition at line 144 of file vil_gauss_reduce.hxx.

◆ rl_round() [9/10]

double rl_round ( double  x,
double   
)
inline

Definition at line 147 of file vil_gauss_reduce.hxx.

◆ rl_round() [10/10]

float rl_round ( double  x,
float   
)
inline

Definition at line 150 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce()

template<class T >
void vil_gauss_reduce ( const vil_image_view< T > &  src_im,
vil_image_view< T > &  dest_im,
vil_image_view< T > &  work_im 
)

Smooth and subsample src_im to produce dest_im.

Applies filter in x and y, then samples every other pixel. work_im provides workspace

Definition at line 22 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_121()

template<class T >
void vil_gauss_reduce_121 ( const vil_image_view< T > &  src_im,
vil_image_view< T > &  dest_im 
)

Smooth and subsample src_im to produce dest_im.

Applies filter in x and y, then samples every other pixel.

Definition at line 97 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_121_1plane()

template<class T >
void vil_gauss_reduce_121_1plane ( const T *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
T *  dest_im,
std::ptrdiff_t  d_x_step,
std::ptrdiff_t  d_y_step 
)

Smooth and subsample single plane src_im in x to produce dest_im using 121 filter in x and y.

Smooths with a 3x3 filter and subsamples

Definition at line 331 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_1plane()

template<class T >
void vil_gauss_reduce_1plane ( const T *  src_im,
unsigned  src_nx,
unsigned  src_ny,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
T *  dest_im,
std::ptrdiff_t  d_x_step,
std::ptrdiff_t  d_y_step 
)

Smooth and subsample single plane src_im in x to produce dest_im.

Applies 1-5-8-5-1 filter in x, then samples every other pixel. Fills [0,(nx+1)/2-1][0,ny-1] elements of dest Assumes dest_im has sufficient data allocated.

This is essentially a utility function, used by mil_gauss_pyramid_builder

By applying twice we can obtain a full gaussian smoothed and sub-sampled 2D image.

Definition at line 284 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_2_3()

template<class T >
void vil_gauss_reduce_2_3 ( const vil_image_view< T > &  src_im,
vil_image_view< T > &  dest_im,
vil_image_view< T > &  work_im 
)

Smooth and subsample src_im to produce dest_im (2/3 size).

Applies filter in x and y, then samples every other pixel. work_im provides workspace

Definition at line 60 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_2_3_1plane()

template<class T >
void vil_gauss_reduce_2_3_1plane ( const T *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
T *  dest_im,
std::ptrdiff_t  d_x_step,
std::ptrdiff_t  d_y_step 
)

Smooth and subsample single plane src_im in x, result is 2/3rd size.

Applies alternate 1-3-1, 1-1 filter in x, then samples every other pixel. Fills [0,(2*ni+1)/3-1][0,nj-1] elements of dest

Note, 131 filter only an approximation

Definition at line 410 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_general()

template<class T >
void vil_gauss_reduce_general ( const vil_image_view< T > &  src_im,
vil_image_view< T > &  dest_im,
vil_image_view< T > &  worka,
vil_image_view< T > &  workb,
const vil_gauss_reduce_params params 
)

Smooth and subsample src_im by an arbitrary factor to produce dest_im.

Parameters
workaprovide workspace to avoid repetitive memory alloc and free
workbprovide workspace to avoid repetitive memory alloc and free

Definition at line 255 of file vil_gauss_reduce.hxx.

◆ vil_gauss_reduce_general_plane()

template<class T >
void vil_gauss_reduce_general_plane ( const vil_image_view< T > &  src,
vil_image_view< T > &  dest,
vil_image_view< T > &  worka,
vil_image_view< T > &  workb,
const vil_gauss_reduce_params params 
)

Smooth and subsample src_im to produce dest_im.

Applies 5 pin filter in x and y, then samples every other pixel. Assumes dest_im has sufficient data allocated

Definition at line 160 of file vil_gauss_reduce.hxx.