Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Attributes
icl::filter::ConvolutionKernel Struct Reference

Utility struct for managing convolution kernel data. More...

#include <ConvolutionKernel.h>

List of all members.

Public Types

enum  fixedType {
  gauss3x3 = 0, gauss5x5 = 10, sobelX3x3 = 1, sobelX5x5 = 11,
  sobelY3x3 = 2, sobelY5x5 = 12, laplace3x3 = 3, laplace5x5 = 13,
  custom
}
 this enum contains several predefined convolution kernel types More...

Public Member Functions

 ConvolutionKernel ()
 creates an empty null kernel
 ConvolutionKernel (const ConvolutionKernel &other)
 crates a copied kernel
 ConvolutionKernel (int *data, const utils::Size &size, int factor=1, bool deepCopy=true) throw (utils::InvalidSizeException)
 create an integer based kernel
 ConvolutionKernel (float *data, const utils::Size &size, bool deepCopy=true) throw (utils::InvalidSizeException)
 create a float valued kernel
 ConvolutionKernel (fixedType t, bool useFloats=false)
 create a fixed kernel (optionally as float kernel)
 ~ConvolutionKernel ()
 Destructor.
ConvolutionKerneloperator= (const ConvolutionKernel &other)
 Assignment operator.
void toFloat ()
 converts internal idata to float data regarding 'factor'
void toInt (bool force=false)
 converts fdata to idata if possible and/or if force flag is true
int getDim () const
 returns kernels width * height
const utils::SizegetSize () const
 returns the kernels size
int getWidth () const
 returns the kernels width
int getHeight () const
 returns the kernels height
bool isFloat () const
 returns whether this kernel has float data
const float * getFloatData () const
 returns the kernels float data pointer (const) (which may be 0)
float * getFloatData ()
 returns the kernels float data pointer (which may be 0)
const int * getIntData () const
 returns the kernels int data pointer (const) (which may be 0)
int * getIntData ()
 returns the kernels int data pointer (which may be 0)
int getFactor () const
 returns the kernels scaling factor (only used if its an integer kernel)
bool isNull () const
 return whether idata or fdata is not null
fixedType getFixedType () const
 returns the kernels fixed type (necessary for IPP-optimization)
void detach ()
 ensures shallow copied data is copied deeply

Private Attributes

utils::Size size
 associated size
float * fdata
 float data pointer
int * idata
 int data pointer
int factor
 scaling factor for integer kernels
bool isnull
 is already initialized
bool owned
 is data owned
fixedType ft
 fixed type set

Detailed Description

Utility struct for managing convolution kernel data.

This structure provides a shallow as well as deep wrapper for int- and float-pointers into ConvolutionKernel-instances. Convolution Kernels can be float- or integer valued.

copies of shallow copied instances are shallow!


Member Enumeration Documentation

this enum contains several predefined convolution kernel types

kernelSobleX

The sobel x filter is a combined filter. It performs a symmetrical border filter operation in x-direction, followed by a smoothing operation in y-direction:

                          ---------     ---        
                         | 1  0 -1 |   | 1 |    ---------
          kernelSobelX = | 2  0 -2 | = | 2 | * | 1  0 -1 |
                         | 1  0 -1 |   | 1 |    ---------
                          ---------     ---
          

kernelSobelY

The sobel y filter is essentially equal to the sobel y filter. The border detection will run in y-direction, and the smoothing x-direction.

                          ---------     ---        
                         | 1  2  1 |   | 1 |    ---------
          kernelSobelY = | 0  0  0 | = | 0 | * | 1  2  1 |
                         |-1 -2 -1 |   |-1 |    ---------
                          ---------     ---
          

kernelGauss3x3

This is a 3x3-Pixel approximation of a 2D Gaussian. It is separable into smoothing filters in x- and y-direction.

                                   ---------     ---        
                                  | 1  2  1 |   | 1 |    ---------
          kernelGauss3x3 = 1/16 * | 2  4  2 | = | 2 | * | 1  2  1 | * (1/4) *(1/4) 
                                  | 1  2  1 |   | 1 |    ---------
                                   ---------     ---
          

kernelGauss5x5

This is a 5x5-Pixel approximation of a 2D Gaussian. It is separable into smoothing filters in x- and y-direction.

                                    ----------------- 
                                   | 2   7  12  7  2 |
                                   | 7  31  52 31  7 |
          kernelGauss5x5 = 1/571 * |12  52 127 52 12 |
                                   | 7  31  52 31  7 |
                                   | 2   7  12  7  2 |
                                    -----------------
          

kernelLaplace

The Laplacian kernel is a discrete approximation of the 2nd derivation of a 2D function.

                           --------- 
                          | 1  1  1 |
          kernelLaplace = | 1 -8  1 |
                          | 1  1  1 |
                           --------- 
          
Enumerator:
gauss3x3 

3x3 approximation of a Gaussian

gauss5x5 

5x5 approximation of a Gaussian

sobelX3x3 

3x3 sobel x filter

sobelX5x5 

5x5 sobel x filter

sobelY3x3 

3x3 sobel y filter

sobelY5x5 

5x5 sobel y filter

laplace3x3 

3x3 approximation of the 2nd derivation

laplace5x5 

5x5 approximation of the 2nd derivation

custom 

Constructor & Destructor Documentation

creates an empty null kernel

crates a copied kernel

shallow wrapped kernels are copied shallowly !

icl::filter::ConvolutionKernel::ConvolutionKernel ( int *  data,
const utils::Size size,
int  factor = 1,
bool  deepCopy = true 
) throw (utils::InvalidSizeException)

create an integer based kernel

factor can be used to rescale convolution results by given factor: Result(x,y) = ( src *(x,y)* kernel ) / factor where *(x,y)* is a convolution at location (x,y)

icl::filter::ConvolutionKernel::ConvolutionKernel ( float *  data,
const utils::Size size,
bool  deepCopy = true 
) throw (utils::InvalidSizeException)

create a float valued kernel

icl::filter::ConvolutionKernel::ConvolutionKernel ( fixedType  t,
bool  useFloats = false 
)

create a fixed kernel (optionally as float kernel)

Destructor.


Member Function Documentation

ensures shallow copied data is copied deeply

returns kernels width * height

returns the kernels scaling factor (only used if its an integer kernel)

returns the kernels fixed type (necessary for IPP-optimization)

const float* icl::filter::ConvolutionKernel::getFloatData ( ) const [inline]

returns the kernels float data pointer (const) (which may be 0)

returns the kernels float data pointer (which may be 0)

returns the kernels height

const int* icl::filter::ConvolutionKernel::getIntData ( ) const [inline]

returns the kernels int data pointer (const) (which may be 0)

returns the kernels int data pointer (which may be 0)

returns the kernels size

returns the kernels width

bool icl::filter::ConvolutionKernel::isFloat ( ) const [inline]

returns whether this kernel has float data

bool icl::filter::ConvolutionKernel::isNull ( ) const [inline]

return whether idata or fdata is not null

ConvolutionKernel& icl::filter::ConvolutionKernel::operator= ( const ConvolutionKernel other)

Assignment operator.

Shallow-wrapped kernels are copied shallowly

converts internal idata to float data regarding 'factor'

void icl::filter::ConvolutionKernel::toInt ( bool  force = false)

converts fdata to idata if possible and/or if force flag is true

'possible' means that all float values do not show decimals


Member Data Documentation

scaling factor for integer kernels

float data pointer

fixed type set

int data pointer

is already initialized

is data owned

associated size


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines