rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvConvolutionFilter Class Reference

Convolution filter. More...

#include <ilviews/bitmaps/filters/convolve.h>

Inheritance diagram for IlvConvolutionFilter:
IlvBitmapFilter

List of all members.

Public Member Functions

 IlvConvolutionFilter (IlvBitmapDataKernel *kernel=0, IlFloat divisor=0, IlFloat bias=0.0)
 Constructor.
 ~IlvConvolutionFilter ()
 Destructor.
IlvBitmapDataapply (IlUInt count=0, const IlvBitmapData **inputs=0)
 Applies the convolution to the given image.
IlFloat getBias () const
 Returns the bias.
IlFloat getDivisor () const
 Returns the divisor.
IlvConvolutionFilter::EdgeMode getEdgeMode () const
 Returns the edge mode.
IlvBitmapDataKernelgetKernel () const
 Returns the kernel.
void setBias (IlFloat bias)
 Sets the bias.
void setDivisor (IlFloat divisor)
 Sets the divisor.
void setEdgeMode (IlvConvolutionFilter::EdgeMode mode)
 Sets the edge mode.
void setKernel (IlvBitmapDataKernel *kernel)
 Sets the kernel.

Detailed Description

Convolution filter.

Library: ilvbmpflt

This bitmap filter lets you apply a matrix convolution to an image. A convolution combines pixels in the input image with neighboring pixels to produce a resulting image. A wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing, and beveling. A matrix convolution is based on an n-by-m matrix (the convolution kernel) that describes how a given pixel value in the input image is combined width its neighboring pixel values to produce a resulting pixel value.

To illustrate, suppose you have an input image that is 5 by 5 pixels, whose color values are as follows:

   0   20   40  235  235
 100  120  140  235  235
 200  220  240  235  255
 225  225  255  255  255
 225  225  255  255  255
 

and you define a 3-by-3 convolution kernel as follows:

  1  2  3
  4  5  6
  7  8  9
 

Let's focus on the pixel at the second row and second column of the source image (source pixel value is 120). The resulting pixel value will be:

 (1 * 0 + 2 * 20 + 3 * 40 + 
 4 * 100 + 5 * 120 + 6 * 140 +
 7 * 200 + 8 * 220 + 9 * 240) / (1 + 2 + 3 +4 + 5 + 6 + 7 + 8 + 9)
 

By default the divisor is the sum of the kernel coefficients but can be specified. A bias value can be added after computing the value. An edge mode can be specified for border values. The edge mode can be one of:

See also:
IlvRGBBitmapData, IlvBitmapFilter, IlvBitmapKernel

Constructor & Destructor Documentation

IlvConvolutionFilter::IlvConvolutionFilter ( IlvBitmapDataKernel kernel = 0,
IlFloat  divisor = 0,
IlFloat  bias = 0.0 
)

Constructor.

Initializes a new instance of the class IlvConvolutionFilter. The default operator is a 3x3 identity kernel.

IlvConvolutionFilter::~IlvConvolutionFilter (  ) 

Destructor.

The destructor releases all the memory used by the instance.


Member Function Documentation

IlFloat IlvConvolutionFilter::getBias (  )  const

Returns the bias.

Returns:
The bias.
IlFloat IlvConvolutionFilter::getDivisor (  )  const

Returns the divisor.

Returns:
The divisor.
IlvConvolutionFilter::EdgeMode IlvConvolutionFilter::getEdgeMode (  )  const

Returns the edge mode.

Returns:
The edge mode.
IlvBitmapDataKernel* IlvConvolutionFilter::getKernel (  )  const

Returns the kernel.

Returns:
The kernel.
void IlvConvolutionFilter::setBias ( IlFloat  bias  ) 

Sets the bias.

Parameters:
bias The new bias.
void IlvConvolutionFilter::setDivisor ( IlFloat  divisor  ) 

Sets the divisor.

If the divisor is 0 then the sum of the kernel coefficients is used. If this coefficient is 0 then the divisor is 1.0.

Parameters:
divisor The new divisor.
void IlvConvolutionFilter::setEdgeMode ( IlvConvolutionFilter::EdgeMode  mode  ) 

Sets the edge mode.

Parameters:
mode The new edge mode.
void IlvConvolutionFilter::setKernel ( IlvBitmapDataKernel kernel  ) 

Sets the kernel.

Parameters:
kernel The new kernel.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.