Function:ImageFilter
Linear filters are an important part of Image Processing Applications. CUVI provides a single generic filter function to apply any filter of any size to an image. We have in-build flags for various famous filters and programmer can input his custom filter elements as well.
Function
|
Parameters
Name | Type | Description |
---|---|---|
src | const CuviImage& | Input Image |
dst | CuviImage& | Output Image |
roi | const CuviRect& | Region of Interest |
filter | const CuviFilter& | This structure contains filter parameters including dimensions of the filter kernel, coefficients and anchor position |
stream | const CuviStream& | GPU stream ID for execution |
Image Type Support
Input | Output |
---|---|
8uC1 | 8uC1 |
8uC3 | 8uC3 |
16uC1 | 16uC1 |
16uC3 | 16uC3 |
32fC1 | 32fC1 |
32fC3 | 32fC3 |
Anchor Position
For creating custom square or rectangular filter kernel, you need to specify the taps as 1D row-major 32bit floating-point array. By default, the center of the 2D filter kernelis placed on the image pixel that corresponds to the current output location. This is known as the filter kernel anchor and it’s position is given by a 2D point. For a 3x3 filter kernel, the default anchor position is -1,-1 which corresponds to the center of the filter kernel, -2,-2 for 5x5 filter and so on. You can change this to another location within the filter kernel through the anchorPositionargument of the imFilter function. Here’s how you create a custom filter kernel and populate it with taps:
Sample
Example
|