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 |
---|---|---|
srcImage | CuviImage* | Input Image |
dstImage | CuviImage* | Output Image |
roi | CuviROI | Region of Interest |
filter | CuviFilter* | This structure contains filter parameters which are dimensions of the filter kernel and filter coefficients |
stream | CuviStream* | GPU stream ID for execution |
Image Type Support
Input | Output |
---|---|
8uC1 | 8uC1 |
8uC3 | 8uC3 |
16uC1 | 16uC1 |
16uC3 | 16uC3 |
32fC1 | 32fC1 |
32fC3 | 32fC3 |
8uC1 | 32fC1 |
8uC3 | 32fC3 |
16uC1 | 32fC1 |
16uC3 | 32fC3 |
Anchor and 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
Error creating thumbnail: Unable to save thumbnail to destination |
Error creating thumbnail: Unable to save thumbnail to destination |
Example
|