VizKit  3.3.7
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
VizKit::VisualConvolutionFilter Class Reference

Convolution filter for bitmap image effects. More...

#include <VisualConvolutionFilter.h>

List of all members.

Public Types

enum  Effect {
  kNone = 0, kBlur, kMotionBlur, kGaussianBlur,
  kLaplacian, kEdgeDetect, kSharpen, kEmboss
}
 Constants for various convolution filters. More...
enum  EdgeAction { kZeroEdges = 0, kClampEdges, kWrapEdges }
 How to calculate edge values. More...

Public Member Functions

 VisualConvolutionFilter (const Effect effect, const uint8 colCount=3, const uint8 rowCount=3)
 The constructor.
 ~VisualConvolutionFilter ()
 The destructor.
 VisualConvolutionFilter (const VisualConvolutionFilter &other)
 Copy constructor.
VisualConvolutionFilteroperator= (const VisualConvolutionFilter &other)
 Assignment operator.
uint8 getNumberOfKernelValueColumns (void) const
 Returns the number of kernel value columns.
uint8 getNumberOfKernelValueRows (void) const
 Returns the number of kernel value rows.
float getPostConvolutionScaleFactor (void) const
 Returns the post convolution scale factor.
float getPostConvolutionBias (void) const
 Returns the post convolution bias.
void copyKernelValues (float *buffer) const
 Copies the kernel values of the convolution filter into the provided buffer.
void applyToPixelData (const PixelColor *pixelData, uint32 imageWidth, uint32 imageHeight, int pixelFormat, int pixelDataType, PixelColor **outPixelData, uint16 numberOfInterations=1) const
 Applies the convolution filter to the pixel data.

Private Types

typedef std::vector< float > KernelValues
 Kernel values of convolution filters are stored in vectors of floats.

Private Member Functions

void copy (const VisualConvolutionFilter &other)
 Copy method for assignment operator and copy constructor.
uint32 clamp (uint32 inVal) const
 Clamps the incoming value between 0 and 255.

Private Attributes

KernelValues kernelValues
 Kernel values.
uint8 numberOfKernelValueColumns
 The number of columns of the kernel values.
uint8 numberOfKernelValueRows
 The number of rows of the kernel values.
float postConvolutionScaleFactor
 The scaling of values applied after the convolution.
float postConvolutionBias
 The bias of values applied after the convolution.
EdgeAction edgeAction
 How the convolution filter treats edge values.

Detailed Description

Convolution filter for bitmap image effects.

A.k.a. kernel filter or matrix. A.k.a. correlation, impulse response, or point spread function.


Member Typedef Documentation

typedef std::vector<float> VizKit::VisualConvolutionFilter::KernelValues [private]

Kernel values of convolution filters are stored in vectors of floats.


Member Enumeration Documentation

How to calculate edge values.

Enumerator:
kZeroEdges 
kClampEdges 

< Edge values are blank.

kWrapEdges 

< Edge values are clamped.

< Edge values are wrapped around.

Constants for various convolution filters.

Enumerator:
kNone 
kBlur 
kMotionBlur 

< Blur filter (lowpass filter).

Eliminates changes that are only a pixel wide. Rapid change from pixel to pixel is blocked while slow change is passed.

kGaussianBlur 

< Motion blur filter.

kLaplacian 

< Gaussian blur filter.

kEdgeDetect 

< Laplacian filter.

kSharpen 

< Filter for edge detection.

kEmboss 

< Sharpens image (highpass filter).

Rapid change from pixel to pixel is passed while slow change is blocked. < Emboss filter that gives the image a relief look (useful when bumpmapping).


Constructor & Destructor Documentation

VisualConvolutionFilter::VisualConvolutionFilter ( const Effect  effect,
const uint8  colCount = 3,
const uint8  rowCount = 3 
)

The constructor.

Parameters:
effectThe name of the convolution filter.
colCountThe number of columns of the kernel matrix. Default = 3.
rowCountThe number of rows of the kernel matrix. Default = 3.
Remarks:
The size of the filter has to be uneven, so that it has a center (e.g. 3x3, 5x5, or 7x7).

The destructor.

Copy constructor.

Parameters:
otherReference to another VisualConvolutionFilter.

Member Function Documentation

void VisualConvolutionFilter::applyToPixelData ( const PixelColor pixelData,
uint32  imageWidth,
uint32  imageHeight,
int  pixelFormat,
int  pixelDataType,
PixelColor **  outPixelData,
uint16  numberOfInterations = 1 
) const

Applies the convolution filter to the pixel data.

Parameters:
pixelDataThe pixel data on which the convolution filter is about to be applied.
imageWidthThe width of the image.
imageHeightThe height of the image.
pixelFormatThe format of the pixel data (rgba, luminance, etc.).
pixelDataTypeThe data type of the pixel data (8-bit byte, float, etc.).
outPixelDataThe result of the convolution operation.
numberOfInterationsOptional number of iterations (default = 1).
uint32 VisualConvolutionFilter::clamp ( uint32  inVal) const [private]

Clamps the incoming value between 0 and 255.

void VisualConvolutionFilter::copy ( const VisualConvolutionFilter other) [private]

Copy method for assignment operator and copy constructor.

Parameters:
otherAnother VisualConvolutionFilter.
void VisualConvolutionFilter::copyKernelValues ( float *  buffer) const

Copies the kernel values of the convolution filter into the provided buffer.

Parameters:
[out]bufferThe buffer into which the kernel values are written.
Remarks:
The caller has to make sure that the provided buffer is big enough to store columns * rows * sizeof(float) values.

Returns the number of kernel value columns.

Returns:
The number of kernel value columns.

Returns the number of kernel value rows.

Returns:
The number of kernel value rows.

Returns the post convolution bias.

Returns:
The post convolution bias.
Remarks:
The bias is a coefficient that is added to each pixel value.

Returns the post convolution scale factor.

Returns:
The post convolution scale factor.
Remarks:
The scale factor is the factor with which each pixel is multiplied.
VisualConvolutionFilter & VisualConvolutionFilter::operator= ( const VisualConvolutionFilter other)

Assignment operator.

Parameters:
otherReference to another VisualConvolutionFilter.

Member Data Documentation

How the convolution filter treats edge values.

Kernel values.

The number of columns of the kernel values.

The number of rows of the kernel values.

The bias of values applied after the convolution.

The scaling of values applied after the convolution.


The documentation for this class was generated from the following files:

Generated on Sun May 3 2015 20:26:31 for VizKit by doxygen 1.8.0