i3dlib

Documentation

Image preprocessing filters


Classes

class  i3d::GradientMagnitudeEstimator< VOXEL >
 This class implements simple Estimator of the gradient magnitude. The Gradient is estimated by simple central differences in the direction of each axe. The Magnitude is computed as the square root of the sum of individual derivatives. More...
class  i3d::SpatialDerivatives< VOXEL >
 This class implements spatial derivatives operator neede for optical flow comp. Documentation TBA. More...
class  i3d::AOSCLMCFilter< VOXELIN, VOXELOUT >
 This class implements the nonlinear diffusion filter, which was published by Catte, Lions, Morel and Coll. As the other nonlinear filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u_{\sigma}|^2) \nabla u)$. More...
class  i3d::AOSTVFilter< VOXELIN, VOXELOUT >
 This class implements the Total Variations nonlinear diffusion filter and the Ballanced Forward Backward filter, which were published by Andreu et al. and Keeling et al. As the other nonlinear filters, these filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div}(\frac{\nabla u}{|\nabla u|}) $. More...
class  i3d::AOSPMFilter< VOXELIN, VOXELOUT >
 This class implements the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published nonlinear diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$. More...
class  i3d::LODGaussianBlur< VOXELIN, VOXELOUT >
 This class implements the classical Gaussian Blur filter by solving the following PDE $ u_t = \Delta u = (u_{xx} + u_{yy}) $. The main advantage is the constant speed of computation for any size of standard deviation $ \sigma $. The speed is comparable to the speed of Fourier transform based filters. The second advantage is that this filter preserve the average grey value of the blurred image. More...
class  i3d::MCFFilter< VOXELIN, VOXELOUT >
 This class implements together with class MCFFilterFunction the Curvature Flow anisotropic diffusion filter, which was published by Alvarez, Lions and Morel. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. Moreover it generates the so called morphological scaale space. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} ( \nabla u / |\nabla u|) |\nabla u|$. The particular implemantion is based on explicit finite difference solver and therefore there exist some limitations to the time step. More...
class  i3d::PMFilter< VOXELIN, VOXELOUT >
 This class implements together with class PMFilterFunction the Perona-Malik anisotropic diffusion filter, which was published by Perona and Malik. This filter was historical first published anisotropic diffusion filter and therefore is fundamental. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = \mathrm{div} (g(|\nabla u|) \nabla u)$. The particular implemantion is based on explicit finite difference solver and therefore there exist some limitations to the time step. If you want to use the schema with no timestep limitation take a look to the documentation of AOSPMFilter. More...
class  i3d::MCDEFilter< VOXELIN, VOXELOUT >
 This class implements together with class MCDEFilterFunction the Modified Curvature Diffusion Flow anisotropic diffusion filter, which was published by Whitaker and Xue. As the other anisotropic filters, this filter smooths the image in the relatively continuos region and do not smooth the significante edges. Moreover it generates the so called morphological scale space. In the typical output image is suppresed the noise and the edges remain sharp and well localised. The diffused image is the solution of the equation $ u_t = |\nabla u| \cdot \mathrm{div} \left( g(| \nabla u|)\frac{ \nabla u }{ |\nabla u|} \right) $. The particular implementation is based on explicit finite difference solver and therefore there exist some limitations to the time step. More...

Functions

template<class VOXEL>
void i3d::Canny3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, float sigma, float scale)
template<class VOXEL>
void i3d::CompassSobel3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::EstimateGradient1_3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void i3d::EstimateGradient2_3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void i3d::Kirsch3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Laplace3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::MarrHildreth3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double sigma1, double sigma2)
template<class VOXEL>
void i3d::Prewitt3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Roberts3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Robinson3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::ShenCastan3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double p, int WinHalfSize)
template<class VOXEL>
void i3d::Sobel3D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Canny2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, float sigma, float scale)
template<class VOXEL>
void i3d::CompassSobel2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::EstimateGradient1_2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void i3d::EstimateGradient2_2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, bool clamp)
template<class VOXEL>
void i3d::Kirsch2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Laplace2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::MarrHildreth2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double sigma1, double sigma2)
template<class VOXEL>
void i3d::Prewitt2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::ShenCastan2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out, double p, int WinHalfSize)
template<class VOXEL>
void i3d::Sobel2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Roberts2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::Robinson2D (Image3d< VOXEL > &in, Image3d< VOXEL > &out)
template<class VOXEL>
void i3d::hystThres3D (Image3d< VOXEL > &data, unsigned short lowThreshold, unsigned short highThreshold)
template<class VOXEL>
void i3d::hystThres2D (Image3d< VOXEL > &data, unsigned short lowThreshold, unsigned short highThreshold)
template<class VOXEL>
void i3d::SigmaFilter (const Image3d< VOXEL > &in, Image3d< VOXEL > &out, const Neighbourhood &neib, const Neighbourhood &neib1, VOXEL sigma, int tres)
 This non-linear filter is designed to supress high frequencies in input image and not to blur the sharp and significant edges in the image.

Function Documentation

template<class VOXEL>
I3D_DLLEXPORT void i3d::Canny2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
float  sigma,
float  scale 
)

Apply 2D Canny edge detector on input image separately for each slice in is input image out is output image sigma is standard deviation of Gauss filter scale scales resulting values

template<class VOXEL>
I3D_DLLEXPORT void i3d::Canny3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
float  sigma,
float  scale 
)

Apply 3D Canny edge detector on input image in is input image out is output image sigma is standard deviation of Gauss filter scale scales resulting values

template<class VOXEL>
I3D_DLLEXPORT void i3d::CompassSobel2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply compass version of 2D Sobel filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::CompassSobel3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply compass version of 3D Sobel filter on input image in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::EstimateGradient1_2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
bool  clamp 
)

Apply simple 2D edge operator on input image separately for each slice in in is input image out is output image clamp - stretch side voxels

template<class VOXEL>
I3D_DLLEXPORT void i3d::EstimateGradient1_3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
bool  clamp 
)

Apply simple 3D edge operator on input image in is input image out is output image clamp - stretch side voxels

template<class VOXEL>
I3D_DLLEXPORT void i3d::EstimateGradient2_2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
bool  clamp 
)

Apply simple 2D edge operator on input image separately for each slice in is input image out is output image clamp - stretch side voxels

template<class VOXEL>
I3D_DLLEXPORT void i3d::EstimateGradient2_3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
bool  clamp 
)

Apply simple 3D edge operator on input image in is input image out is output image clamp - stretch side voxels

template<class VOXEL>
I3D_DLLEXPORT void i3d::hystThres2D ( Image3d< VOXEL > &  data,
unsigned short  lowThreshold,
unsigned short  highThreshold 
)

Apply 2D hysteresis threshold on input image separately for each slice data is input image and output image lowThreshold is lower value of threshold highThreshold is higher value of threshold

template<class VOXEL>
I3D_DLLEXPORT void i3d::hystThres3D ( Image3d< VOXEL > &  data,
unsigned short  lowThreshold,
unsigned short  highThreshold 
)

Apply 3D hysteresis threshold on input image data is input image and output image lowThreshold is lower value of threshold highThreshold is higher value of threshold

template<class VOXEL>
I3D_DLLEXPORT void i3d::Kirsch2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 2D Kirsch filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Kirsch3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 3D Kirsch filter on input image in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Laplace2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 2D Laplace filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Laplace3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 3D Laplace filter on input image in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::MarrHildreth2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
double  sigma1,
double  sigma2 
)

Apply 2D Marr-Hildreth edge detector on input image separately for each slice This edge detector doesn't respect anisotropic image in is input image out is output image sigma1 is standard deviation of Gauss filter sigma2 is standard deviation of Gauss filter

template<class VOXEL>
I3D_DLLEXPORT void i3d::MarrHildreth3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
double  sigma1,
double  sigma2 
)

Apply 3D Marr-Hildreth edge detector on input image This edge detector doesn't respect anisotropic image in is input image out is output image sigma1 is standard deviation of Gauss filter sigma2 is standard deviation of Gauss filter

template<class VOXEL>
I3D_DLLEXPORT void i3d::Prewitt2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 2D Prewitt filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Prewitt3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 3D Prewitt filter on input image in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Roberts2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 2D Roberts filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Roberts3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 3D Roberts filter on input image in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Robinson2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 2D Robinson filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Robinson3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 3D Robinson filter on input image in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::ShenCastan2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
double  p,
int  WinHalfSize 
)

Apply 2D Shen-Castan edge detector on input image separately for each slice This edge detector doesn't respect anisotropic image in is input image out is output image p is parameter to ISEF filter WinHalfSize is half-size of window for adaptive gradient function

template<class VOXEL>
I3D_DLLEXPORT void i3d::ShenCastan3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
double  p,
int  WinHalfSize 
)

Apply 3D Shen-Castan edge detector on input image This edge detector doesn't respect anisotropic image in is input image out is output image p is parameter to ISEF filter WinHalfSize is half-size of window for adaptive gradient function

template<class VOXEL>
I3D_DLLEXPORT void i3d::SigmaFilter ( const Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out,
const Neighbourhood &  neib,
const Neighbourhood &  neib1,
VOXEL  sigma,
int  tres 
)

This non-linear filter is designed to supress high frequencies in input image and not to blur the sharp and significant edges in the image.

This non-linear filter is designed to supress high frequencies in input image and not to blur the sharp and significant edges in the image. The implementation of this filter is based on the article: Jong-Sen Lee: Digital Image Smoothing and the Sigma Filter, Computer Vision, Graphics and Image processing, volume 24, 255-269, year 1983. The parameters are: in - input image out -- output image neib -- the type of neighbourhood, where the weighted sigma sum should be computed neib1 -- the type of neighbourhood, where the average of immediate neighbours should be computed sigma -- the maximal deviation (it has similar mean as the sigma parameter in classic gaussian). tres -- value of auxilliary treshold.

The Algorithm: For every voxel of the input image: 1) Compute first the tolerance interval T. T = (x_i - sigma, x_i + sigma)

2) Compute weighted average of voxel values in the "neib" neighbourhood.

Weighted_Sum = SUM_{x all_voxels_in_neib} ( x * delta_x ) Weighted_Divider = SUM_{x all_voxels_in_neib} (delta_x) Weighted_Average = Weighted_Sum / Weighted_Divider where delta_x = 1 if x T delta_x = 0 otherwise

3) if Weighted_Divider is > tres output_voxel = Weighted_sum else Immediate_Neighbors_Average = SUM_{x all_voxels_in_neib1} x / |{all_voxels_in_neib1} | output_voxel = Immediate_Neighbors_Average

The Meaning: In steps 1 and 2 of the algorithm we make only better gaussian, We don't compute the average from the voxels, which Intesity value is far from the value of the central voxel of the neighbourhood. This should supress the noise and should not blur the significcant edges. In the fourth step we can supress some hot cluster noise. If the central voxel has the intensity value far from the values of his neighbours (The Weighted_Divider is small number), it is probably member of "hot cluster", so we should save the Immediate_neighbours_Average in the output image rather than the Weighted_average.

The usage: input and output image should be GRAY8, GRAY16 or float. the "neib" parameter is supposed to be the box neighbourhood constructed with function void ConstructBoxNeighbourhood(Neighbourhood nb,double r1, double r2, double r3) (see neighbours.h)

the "neib1" parameter should be the classic constant 4 or 8 neighbourhood in 2D, or 6, 18, or 26 neighbourhood in 3D. (See neighbours.h)

the parameter "sigma" should be relative small (5-20) fo noisy low contrast images. the parameter "tres" shoulb be < 4 for 7x7 neighbourhood in 2D < 3 for 5x5 neighbourhood.

Pretty results can be obtained by iterative use of the filter with constant or growing sigma. (the output of one iteration is the input of next iteration)

template<class VOXEL>
I3D_DLLEXPORT void i3d::Sobel2D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 2D Sobel filter on input image separately for each slice in is input image out is output image

template<class VOXEL>
I3D_DLLEXPORT void i3d::Sobel3D ( Image3d< VOXEL > &  in,
Image3d< VOXEL > &  out 
)

Apply 3D Sobel filter on input image in is input image out is output image