MtxVec VCL
|
Applies 2D filtering
Computes the dot-product between the kernel matrix and underlaying source matrix elements for each possible position of the kernel and stores the result in to the calling object. Typically the kernel is much smaller than the source matrix. The operation is equivalent to the 2D Convolution and is used also for image resampling, image blurring etc..
SrcRect must meet the following condtitions:
SrcRect.Width <= (Src.Cols - Kernel.Cols) SrcRect.Height <= (Src.Rows - Kernel.Rows)
KernelAnchor defines the value to be written in the destination matrix relative to the corresponding position of the Kernel in the Src matrix. This can be for example center element (Kernel.Rows div 2, Kernel.Cols div 2), top left (0,0), bottom right (Kernel.Rows-1, Kernel.Cols-1) element etc... The X and Y coordinates may not exceed Kernel row or column count.
The kernel can be square or not. Symmetric or not. The only requirement is that it is rectangular.
It is the users responsability to select such combination of SrcRect, Kernel size and KernelAnchor to get desired border value processing. If the Kernel is 3x3 in size, then it would make sense that SrcRect leaves out 2 rows above and below and also 2 columns left and right in the Src matrix. These regions then need to be initialized to some value for example 0 for black color or use the value of the closest border element.
The DstRect defines the area to be overwritten in the destination matrix. The width and height parameters of DstRect and SrcRect need to match. The Size of the destination matrix needs to be big enough to allow DstRect position and dimensions.
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|