|
|
Functions | |
| array | filter (const array &image, const array &kernel) |
| Image Filtering. | |
| array | medfilt (const array &image, const unsigned height=3, const unsigned width=3) |
| Median filtering within window (default 3x3) | |
| array | bilateral (const array &image, const float space, const float color) |
| Bilateral filtering. | |
| array | meanshift (const array &image, const float space, const float color, const int iter=5) |
| Meanshift filtering. | |
| array | convolve (const array &f1, const array &f2, const array &signal, bool expand=false) |
| Separable convolution (2D) with device arrays. | |
| template<typename ty > | |
| array | convolve (unsigned n1, const ty *f1, unsigned n2, const ty *f2, const array &signal, bool expand=false) |
| Separable convolution (2D) with host arrays. | |
| array | convolve (const array &signal, const array &filter, bool expand=false) |
| Convolution (1D,2D,3D). | |
| template<typename ty > | |
| array | convolve (const array &signal, unsigned ndims, unsigned *dims, const ty *h_kernel, bool expand=false) |
| Convolution (1D,2D,3D) with host filter. | |
| array af::filter | ( | const array & | image, |
| const array & | kernel | ||
| ) |
Image Filtering.
// filter (convolve) an image with a 3x3 sobel kernel const float h_kernel[] = { -2.0, -1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 1.0, 2.0 }; array kernel = array(3,3,h_kernel); array img_out = filter(img_in, kernel);
| [in] | image | |
| [in] | kernel | coefficient matrix |
| array af::medfilt | ( | const array & | image, |
| const unsigned | height = 3, |
||
| const unsigned | width = 3 |
||
| ) |
| array af::bilateral | ( | const array & | image, |
| const float | space, | ||
| const float | color | ||
| ) |
Bilateral filtering.
// bilateral filter an image with color values [0-1] float sigma_space = 2.f; float sigma_color = 0.1f; array img_out = bilateral(img_in, sigma_space, sigma_color); // bilateral filter an image with color values [0-255] float sigma_space = 2.f; float sigma_color = 0.1f * 255.f; array img_out = bilateral(img_in, sigma_space, sigma_color);
| [in] | image | input image |
| [in] | space | radius in pixels, area for filtering. note: internally space *= 1.5 |
| [in] | color | difference in color allowed, range depends on values in image |
color range depends on values in the image if image is [0-1], scale color from [0-1]; if image is [0-255], scale color from [0-255]; | array af::meanshift | ( | const array & | image, |
| const float | space, | ||
| const float | color, | ||
| const int | iter = 5 |
||
| ) |
Meanshift filtering.
// meanshift filter an image with color values [0-1] float sigma_space = 3.f; float sigma_color = 0.2f; int iterations = 5; array img_out = meanshift(img_in, sigma_space, sigma_color, iterations); // meanshift filter an image with color values [0-255] float sigma_space = 3.f; float sigma_color = 0.2f * 255.f; int iterations = 5; array img_out = meanshift(img_in, sigma_space, sigma_color, iterations);
| [in] | image | input image |
| [in] | space | radius in pixels, area for filtering. note: internally space *= 1.5 |
| [in] | color | difference in color allowed, range depends on values in image |
| [in] | iter | maximum number of iterations for convergence (default=5, max=100) |
color range depends on values in the image if image is [0-1], scale color from [0-1]; if image is [0-255], scale color from [0-255]; | array af::convolve | ( | const array & | f1, |
| const array & | f2, | ||
| const array & | signal, | ||
| bool | expand = false |
||
| ) |
Separable convolution (2D) with device arrays.
| [in] | f1 | filter along the columns (first dimension) |
| [in] | f2 | filter along the rows (second dimension) |
| [in] | signal | |
| [in] | expand | Performs expanded convolution if true. Default is false |
| array af::convolve | ( | unsigned | n1, |
| const ty * | f1, | ||
| unsigned | n2, | ||
| const ty * | f2, | ||
| const array & | signal, | ||
| bool | expand = false |
||
| ) |
Separable convolution (2D) with host arrays.
| [in] | n1 | number of elements in f1 |
| [in] | f1 | host pointer containing the column filter |
| [in] | n2 | number of elements in f2 |
| [in] | f2 | host pointer containing the row filter |
| [in] | signal | |
| [in] | expand | Performs expanded convolution if true. Default is false |
| array af::convolve | ( | const array & | signal, |
| const array & | filter, | ||
| bool | expand = false |
||
| ) |
| array af::convolve | ( | const array & | signal, |
| unsigned | ndims, | ||
| unsigned * | dims, | ||
| const ty * | h_kernel, | ||
| bool | expand = false |
||
| ) |
Convolution (1D,2D,3D) with host filter.
array x = randu(5); print(x); array f = constant(1,3); // 2D convolution, 3x3 filter float f[] = {0,1,0,1,0,1,0,1,0}; unsigned d[] = {3,3}; array c = convolve(x,2,d,f); print(c);
| [in] | signal | |
| [in] | ndims | Number of dimensions for the filter h_kernel |
| [in] | dims | Array containing dimension sizes of filter h_kernel |
| [in] | h_kernel | Host-side array containing the filter kernel coefficients |
| [in] | expand | Performs expanded convolution if true. Default is false |