Image Component Library (ICL)
|
Class for Image convolutions. More...
#include <ConvolutionOp.h>
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 ConvolutionKernel & | getKernel () const |
returns currently used kernel (const) | |
ConvolutionKernel & | getKernel () |
returns currently used kernel (const) | |
Private Attributes | |
ConvolutionKernel | m_kernel |
bool | m_forceUnsignedOutput |
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.
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:
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.
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:
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.
icl::filter::ConvolutionOp::ConvolutionOp | ( | const ConvolutionKernel & | kernel = ConvolutionKernel() | ) |
Default constructor (force unsigned is set to false)
icl::filter::ConvolutionOp::ConvolutionOp | ( | const ConvolutionKernel & | kernel, |
bool | forceUnsignedOutput | ||
) |
create with optional force unsigned output flag
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.
src | source image |
dst | destination image |
Implements icl::filter::UnaryOp.
const ConvolutionKernel& icl::filter::ConvolutionOp::getKernel | ( | ) | const [inline] |
returns currently used kernel (const)
ConvolutionKernel& icl::filter::ConvolutionOp::getKernel | ( | ) | [inline] |
returns currently used kernel (const)
void icl::filter::ConvolutionOp::setKernel | ( | const ConvolutionKernel & | kernel | ) | [inline] |
change kernel
bool icl::filter::ConvolutionOp::m_forceUnsignedOutput [private] |