Functions
vil_gauss_reduce.cxx File Reference

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

#include <cmath>
#include "vil_gauss_reduce.h"
#include <cassert>
#include <vxl_config.h>
#include <vnl/vnl_erf.h>
#include <vnl/vnl_math.h>

Go to the source code of this file.

Functions

template<>
void vil_gauss_reduce_1plane (const vxl_byte *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, vxl_byte *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<>
void vil_gauss_reduce_1plane (const float *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, float *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<>
void vil_gauss_reduce_1plane (const double *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, double *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<>
void vil_gauss_reduce_1plane (const int *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, int *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<>
void vil_gauss_reduce_1plane (const vxl_int_16 *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, vxl_int_16 *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<>
void vil_gauss_reduce_2_3_1plane (const float *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, float *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...
 
template<>
void vil_gauss_reduce_2_3_1plane (const double *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, double *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...
 
template<>
void vil_gauss_reduce_2_3_1plane (const vxl_byte *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, vxl_byte *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...
 
template<>
void vil_gauss_reduce_2_3_1plane (const int *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, int *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...
 
template<>
void vil_gauss_reduce_2_3_1plane (const vxl_int_16 *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, vxl_int_16 *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...
 
template<>
void vil_gauss_reduce_121_1plane (const vxl_byte *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, vxl_byte *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<>
void vil_gauss_reduce_121_1plane (const float *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, float *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<>
void vil_gauss_reduce_121_1plane (const double *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, double *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<>
void vil_gauss_reduce_121_1plane (const int *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, int *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<>
void vil_gauss_reduce_121_1plane (const vxl_int_16 *src_im, unsigned src_ni, unsigned src_nj, std::ptrdiff_t s_x_step, std::ptrdiff_t s_y_step, vxl_int_16 *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...
 

Detailed Description

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

Author
Tim Cootes

Definition in file vil_gauss_reduce.cxx.

Function Documentation

◆ vil_gauss_reduce_121_1plane() [1/5]

template<>
void vil_gauss_reduce_121_1plane ( const vxl_byte *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
vxl_byte *  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 446 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_121_1plane() [2/5]

template<>
void vil_gauss_reduce_121_1plane ( const float *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
float *  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 518 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_121_1plane() [3/5]

template<>
void vil_gauss_reduce_121_1plane ( const double *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
double *  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 590 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_121_1plane() [4/5]

template<>
void vil_gauss_reduce_121_1plane ( const int *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
int *  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 662 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_121_1plane() [5/5]

template<>
void vil_gauss_reduce_121_1plane ( const vxl_int_16 *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
vxl_int_16 *  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 734 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_1plane() [1/5]

template<>
void vil_gauss_reduce_1plane ( const vxl_byte *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
vxl_byte *  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,(ni+1)/2-1][0,nj-1] elements of dest

Definition at line 22 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_1plane() [2/5]

template<>
void vil_gauss_reduce_1plane ( const float *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
float *  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,(ni+1)/2-1][0,nj-1] elements of dest

Definition at line 67 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_1plane() [3/5]

template<>
void vil_gauss_reduce_1plane ( const double *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
double *  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,(ni+1)/2-1][0,nj-1] elements of dest

Definition at line 108 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_1plane() [4/5]

template<>
void vil_gauss_reduce_1plane ( const int *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
int *  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,(ni+1)/2-1][0,nj-1] elements of dest

Definition at line 148 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_1plane() [5/5]

template<>
void vil_gauss_reduce_1plane ( const vxl_int_16 *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
vxl_int_16 *  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,(ni+1)/2-1][0,nj-1] elements of dest

Definition at line 190 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_2_3_1plane() [1/5]

template<>
void vil_gauss_reduce_2_3_1plane ( const float *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
float *  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 237 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_2_3_1plane() [2/5]

template<>
void vil_gauss_reduce_2_3_1plane ( const double *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
double *  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 278 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_2_3_1plane() [3/5]

template<>
void vil_gauss_reduce_2_3_1plane ( const vxl_byte *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
vxl_byte *  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 319 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_2_3_1plane() [4/5]

template<>
void vil_gauss_reduce_2_3_1plane ( const int *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
int *  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 363 of file vil_gauss_reduce.cxx.

◆ vil_gauss_reduce_2_3_1plane() [5/5]

template<>
void vil_gauss_reduce_2_3_1plane ( const vxl_int_16 *  src_im,
unsigned  src_ni,
unsigned  src_nj,
std::ptrdiff_t  s_x_step,
std::ptrdiff_t  s_y_step,
vxl_int_16 *  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 406 of file vil_gauss_reduce.cxx.