VizKit
3.3.7
|
Convolution filter for bitmap image effects. More...
#include <VisualConvolutionFilter.h>
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. | |
VisualConvolutionFilter & | operator= (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. |
Convolution filter for bitmap image effects.
A.k.a. kernel filter or matrix. A.k.a. correlation, impulse response, or point spread function.
typedef std::vector<float> VizKit::VisualConvolutionFilter::KernelValues [private] |
Kernel values of convolution filters are stored in vectors of floats.
Constants for various convolution filters.
VisualConvolutionFilter::VisualConvolutionFilter | ( | const Effect | effect, |
const uint8 | colCount = 3 , |
||
const uint8 | rowCount = 3 |
||
) |
The constructor.
effect | The name of the convolution filter. |
colCount | The number of columns of the kernel matrix. Default = 3. |
rowCount | The number of rows of the kernel matrix. Default = 3. |
The destructor.
VisualConvolutionFilter::VisualConvolutionFilter | ( | const VisualConvolutionFilter & | other | ) |
Copy constructor.
other | Reference to another VisualConvolutionFilter. |
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.
pixelData | The pixel data on which the convolution filter is about to be applied. |
imageWidth | The width of the image. |
imageHeight | The height of the image. |
pixelFormat | The format of the pixel data (rgba, luminance, etc.). |
pixelDataType | The data type of the pixel data (8-bit byte, float, etc.). |
outPixelData | The result of the convolution operation. |
numberOfInterations | Optional 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.
other | Another VisualConvolutionFilter. |
void VisualConvolutionFilter::copyKernelValues | ( | float * | buffer | ) | const |
Copies the kernel values of the convolution filter into the provided buffer.
[out] | buffer | The buffer into which the kernel values are written. |
uint8 VisualConvolutionFilter::getNumberOfKernelValueColumns | ( | void | ) | const |
Returns the number of kernel value columns.
uint8 VisualConvolutionFilter::getNumberOfKernelValueRows | ( | void | ) | const |
Returns the number of kernel value rows.
float VisualConvolutionFilter::getPostConvolutionBias | ( | void | ) | const |
Returns the post convolution bias.
float VisualConvolutionFilter::getPostConvolutionScaleFactor | ( | void | ) | const |
Returns the post convolution scale factor.
VisualConvolutionFilter & VisualConvolutionFilter::operator= | ( | const VisualConvolutionFilter & | other | ) |
Assignment operator.
other | Reference to another VisualConvolutionFilter. |
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.
float VizKit::VisualConvolutionFilter::postConvolutionBias [private] |
The bias of values applied after the convolution.
float VizKit::VisualConvolutionFilter::postConvolutionScaleFactor [private] |
The scaling of values applied after the convolution.