Smooths images. More...
#include <vcl_vector.h>
#include <vil/vil_image_view.h>
#include <vil/algo/vil_convolve_1d.h>
#include <vil/vil_transpose.h>
Go to the source code of this file.
Classes | |
class | vil_gauss_filter_5tap_params |
Functions | |
template<class srcT , class destT > | |
void | vil_gauss_filter_5tap (const srcT *src_im, vcl_ptrdiff_t src_ystep, unsigned ni, unsigned nj, destT *dest_im, vcl_ptrdiff_t dest_ystep, const vil_gauss_filter_5tap_params ¶ms, destT *work) |
Smooth a single plane src_im to produce dest_im. | |
template<class srcT , class destT > | |
void | vil_gauss_filter_5tap (const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, const vil_gauss_filter_5tap_params ¶ms, vil_image_view< destT > &work) |
Smooth a src_im to produce dest_im. | |
template<class srcT , class destT > | |
void | vil_gauss_filter_5tap (const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, const vil_gauss_filter_5tap_params ¶ms) |
Smooth a src_im to produce dest_im. | |
void | vil_gauss_filter_gen_ntap (double sd, unsigned diff, vcl_vector< double > &filter_dest) |
Generate an n-tap FIR filter from a Gaussian function. | |
template<class srcT , class destT > | |
void | vil_gauss_filter_1d (const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, double sd, unsigned half_width) |
Smooth a src_im to produce dest_im with gaussian of width sd. | |
template<class srcT , class destT > | |
void | vil_gauss_filter_2d (const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, double sd, unsigned half_width, vil_convolve_boundary_option boundary=vil_convolve_zero_extend) |
Smooth a src_im to produce dest_im with gaussian of width sd. | |
template<class srcT , class destT > | |
void | vil_gauss_filter_2d (const vil_image_view< srcT > &src_im, vil_image_view< destT > &dest_im, double sd_i, unsigned half_width_i, double sd_j, unsigned half_width_j, vil_convolve_boundary_option boundary=vil_convolve_zero_extend) |
Smooth a src_im to produce dest_im with gaussian of width sd. |
Smooths images.
Definition in file vil_gauss_filter.h.
void vil_gauss_filter_1d | ( | const vil_image_view< srcT > & | src_im, |
vil_image_view< destT > & | dest_im, | ||
double | sd, | ||
unsigned | half_width | ||
) | [inline] |
Smooth a src_im to produce dest_im with gaussian of width sd.
Generates gaussian filter of width sd, using (2*half_width+1) values in the filter. Typically half_width>3sd. Convolves this with src_im to generate dest_im.
Definition at line 120 of file vil_gauss_filter.h.
void vil_gauss_filter_2d | ( | const vil_image_view< srcT > & | src_im, |
vil_image_view< destT > & | dest_im, | ||
double | sd, | ||
unsigned | half_width, | ||
vil_convolve_boundary_option | boundary = vil_convolve_zero_extend |
||
) | [inline] |
Smooth a src_im to produce dest_im with gaussian of width sd.
Generates gaussian filter of width sd, using (2*half_width+1) values in the filter. Typically half_width>3sd. Convolves this with src_im to generate work_im, then applies filter vertically to generate dest_im.
Definition at line 136 of file vil_gauss_filter.h.
void vil_gauss_filter_2d | ( | const vil_image_view< srcT > & | src_im, |
vil_image_view< destT > & | dest_im, | ||
double | sd_i, | ||
unsigned | half_width_i, | ||
double | sd_j, | ||
unsigned | half_width_j, | ||
vil_convolve_boundary_option | boundary = vil_convolve_zero_extend |
||
) | [inline] |
Smooth a src_im to produce dest_im with gaussian of width sd.
Generates two gaussian filters of width sd_i,sd_j, using (2*half_width_i+1) values in the filter. Typically half_width>3sd. Convolves this with src_im to generate work_im, then applies filter vertically to generate dest_im.
Definition at line 167 of file vil_gauss_filter.h.
void vil_gauss_filter_5tap | ( | const srcT * | src_im, |
vcl_ptrdiff_t | src_ystep, | ||
unsigned | ni, | ||
unsigned | nj, | ||
destT * | dest_im, | ||
vcl_ptrdiff_t | dest_ystep, | ||
const vil_gauss_filter_5tap_params & | params, | ||
destT * | work | ||
) |
Smooth a single plane src_im to produce dest_im.
Applies 5 element FIR filter in x and y. Assumes dest_im has sufficient data allocated.
void vil_gauss_filter_5tap | ( | const vil_image_view< srcT > & | src_im, |
vil_image_view< destT > & | dest_im, | ||
const vil_gauss_filter_5tap_params & | params, | ||
vil_image_view< destT > & | work | ||
) |
Smooth a src_im to produce dest_im.
Applies 5 element FIR filter in x and y.
Definition at line 144 of file vil_gauss_filter.txx.
void vil_gauss_filter_5tap | ( | const vil_image_view< srcT > & | src_im, |
vil_image_view< destT > & | dest_im, | ||
const vil_gauss_filter_5tap_params & | params | ||
) | [inline] |
Smooth a src_im to produce dest_im.
Applies 5 element FIR filter in x and y.
Definition at line 91 of file vil_gauss_filter.h.
void vil_gauss_filter_gen_ntap | ( | double | sd, |
unsigned | diff, | ||
vcl_vector< double > & | filter | ||
) |
Generate an n-tap FIR filter from a Gaussian function.
The filter uses the equation , where D is the differential operator, and k is a normalising constant.
diff | The number of differential operators to apply to the filter. If you want just a normal gaussian, set diff to 0. |
sd | The width of the gaussian. |
The taps will be calculated using the integral of the above equation over the pixel width. However, aliasing will reduce the meaningfulness of your filter when sd << (diff+1). In most applications you will want filter.size() ~= sd*7, which will avoid significant truncation, without wasting the outer taps on near-zero values.
Definition at line 65 of file vil_gauss_filter.cxx.