Functions
vil_median.h File Reference

Perform median filtering on images. More...

#include <algorithm>
#include <vil/algo/vil_structuring_element.h>
#include <vil/vil_image_view.h>

Go to the source code of this file.

Functions

template<class T , class Iter >
vil_sorted_value (const T *im, const std::ptrdiff_t *offset, Iter values, unsigned n, unsigned r)
 Return r-th sorted value of im[offset[k]]. More...
 
template<class T >
vil_sorted_value (const vil_image_view< T > &image, unsigned plane, const vil_structuring_element &element, int i0, int j0, std::vector< T > &values, double r)
 Return (n*r)-th sorted value of pixels under element centred at (i0,j0). More...
 
template<class T >
void vil_median (const vil_image_view< T > &src_image, vil_image_view< T > &dest_image, const vil_structuring_element &element)
 Computes median value of pixels under structuring element. More...
 

Detailed Description

Perform median filtering on images.

Author
Tim Cootes

Definition in file vil_median.h.

Function Documentation

◆ vil_median()

template<class T >
void vil_median ( const vil_image_view< T > &  src_image,
vil_image_view< T > &  dest_image,
const vil_structuring_element element 
)

Computes median value of pixels under structuring element.

dest_image(i0,j0) is the median value of the pixels under the structuring element when it is centred on src_image(i0,j0)

Definition at line 18 of file vil_median.hxx.

◆ vil_sorted_value() [1/2]

template<class T , class Iter >
T vil_sorted_value ( const T *  im,
const std::ptrdiff_t *  offset,
Iter  values,
unsigned  n,
unsigned  r 
)
inline

Return r-th sorted value of im[offset[k]].

Values im[offset[k]] placed into values[k] then sorted. values should be a random access iterator into a container of T such that the range [values,values+n) is valid.

Definition at line 20 of file vil_median.h.

◆ vil_sorted_value() [2/2]

template<class T >
T vil_sorted_value ( const vil_image_view< T > &  image,
unsigned  plane,
const vil_structuring_element element,
int  i0,
int  j0,
std::vector< T > &  values,
double  r 
)
inline

Return (n*r)-th sorted value of pixels under element centred at (i0,j0).

Parameters
rin [0,1].
valuesused to store values sampled from image before sorting Checks boundary overlap

Definition at line 36 of file vil_median.h.