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

Class for Image convolutions. More...

#include <ConvolutionOp.h>

Inheritance diagram for icl::filter::ConvolutionOp:
icl::filter::NeighborhoodOp icl::utils::Uncopyable icl::filter::UnaryOp icl::utils::Configurable icl::filter::DynamicConvolutionOp

List of all members.

Public Member Functions

 ConvolutionOp (const ConvolutionKernel &kernel=ConvolutionKernel())
 Default constructor (force unsigned is set to false)
 ConvolutionOp (const ConvolutionKernel &kernel, bool forceUnsignedOutput)
 create with optional force unsigned output flag
void apply (const core::ImgBase *src, core::ImgBase **dst)
 performs the convolution operation on the image
void setKernel (const ConvolutionKernel &kernel)
 change kernel
const ConvolutionKernelgetKernel () const
 returns currently used kernel (const)
ConvolutionKernelgetKernel ()
 returns currently used kernel (const)

Private Attributes

ConvolutionKernel m_kernel
bool m_forceUnsignedOutput

Detailed Description

Class for Image convolutions.

(Img8u, Img32f: IPP + Fallback, all other Types: Fallback only!) \ The ConvolutionOp class provides functionality for any kind of convolution filters. As most other filter operations, it operates on the source images ROI only. Because the filter mask has to fit into the image at every point of the ROI, the ROI is eventually shrinked as described in base class Filter.

Performance (IPP-Optimized)

All possible filter operations can be divided in 4 cases, depending on the source and destination images depths and the depth of the used filter kernel. While all image depths are supported, the only available kernel depths are depth32f (floating point) and depth32s (32-bit signed integer) Note the differences of the following cases:

case images: depth8u, depth16s, depth32s

In this case, an integer kernel is preferred. That means, that an integer kernel will be used, if available. Using a float kernel causes a marginal decline in performance.

case images: depth32f, depth64f

In this case, a float kernel is preferred. If it is not available, the fallback integer-kernel must be used. As convolution operations of float images with integer kernels are not supported by the IPP, the kernel is converted internally into a float-kernel.


The IPP-optimized functions are VERY fast in comparison to the fallback C++ implementations. The optimized 3x3 convolution functions provided by the IPP are more then 20 times faster. Here are some benchmarks:

Buffering Kernels

In some applications the ConvolutionOp object has to be created during runtime. If the filter-kernel is created elsewhere, and it is persistent over the lifetime of the ConvolutionOp object, it may not be necessary to deeply copy the kernel into an internal buffer of the ConvolutionOp object. To make the ConvolutionOp object just using a given kernel pointer, an additional flag iBufferData can be set in two Constructors.

Constructor & Destructor Documentation

Default constructor (force unsigned is set to false)

icl::filter::ConvolutionOp::ConvolutionOp ( const ConvolutionKernel kernel,
bool  forceUnsignedOutput 

create with optional force unsigned output flag

Member Function Documentation

void icl::filter::ConvolutionOp::apply ( const core::ImgBase src,
core::ImgBase **  dst 
) [virtual]

performs the convolution operation on the image

The destination image is automatically set up to correct size and its channel count is set to the source images channel count.

srcsource image
dstdestination image

Implements icl::filter::UnaryOp.

returns currently used kernel (const)

returns currently used kernel (const)

void icl::filter::ConvolutionOp::setKernel ( const ConvolutionKernel kernel) [inline]

change kernel

Member Data Documentation

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