Difference between revisions of "Function:ImageFilter"
(Created page with "__NOTOC__ 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...") |
|||
Line 34: | Line 34: | ||
| filter | | filter | ||
| CuviFilter* | | CuviFilter* | ||
| This structure contains filter parameters | | This structure contains filter parameters including dimensions of the filter kernel, coefficients and anchor position | ||
|- | |- | ||
| stream | | stream | ||
Line 81: | Line 81: | ||
=== | ===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: | 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: | ||
Line 90: | Line 90: | ||
{| | {| | ||
|- | |- | ||
|[[File: | |[[File:Filterinc.jpg|frame|Input]] | ||
|[[File: | |[[File:Filtera55.jpg|frame|Average 5x5]] | ||
|[[File:Filtergs.jpg|frame|Gaussian 5x5 with sigma=0.35]] | |||
|[[File:Filteru.jpg|frame|Unsharp with alpha=0.2]] | |||
|} | |} | ||
Revision as of 20:37, 26 April 2012
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 including dimensions of the filter kernel, coefficients and anchor position |
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 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 |
Error creating thumbnail: Unable to save thumbnail to destination |
Error creating thumbnail: Unable to save thumbnail to destination |
Example
|