Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.7 Filters

The Guile-CV procedures and methods to filter images.

Procedures

`im-gaussian-blur`
`im-gaussian-blur-channel`
`im-gaussian-gradient`
`im-gaussian-gradient-channel`
`im-gaussian-sharp`
`im-gaussian-sharp-channel`
`im-sharpen`
`im-sharpen-channel`
`im-median-filter`
`im-median-filter-channel`
`im-convolve`
`im-convolve-channel`
`im-nl-means`
`im-nl-means-channel`
Procedure: im-gaussian-blur image sigma
Procedure: im-gaussian-blur-channel channel width height sigma

Returns a new image or channel.

The new image or new channel is the result of the computation of the Gaussian blurring, also known as the Gaussian smoothing, by means of a convolution of image or channel with a 2D Gaussian function, where sigma is the standard deviation of the Gaussian distribution.

Procedure: im-gaussian-gradient-channel channel width height sigma

Returns a new image or channel.

The new image or new channel is the result of the computation of the strength of the first order partial derivatives by means of a convolution of image or channel with the first order derivative of a 2D Gaussian function, where sigma is the standard deviation of the Gaussian distribution.

Procedure: im-gaussian-sharp image factor scale
Procedure: im-gaussian-sharp-channel channel width height factor scale

Returns a new image or channel.

The new image or new channel is the result of the computation of the Gaussian sharpening: the procedure does (a) perform a Gaussian smoothing at the given scale to create a temporary image `smooth` and (b) blends image and `smooth` according to the formula `(- (* (+ factor 1) image) (* smooth factor))`.

Procedure: im-sharpen image factor
Procedure: im-sharpen-channel channel width height factor

Returns a new image or channel.

This procedure performs a ‘simple sharpening’ operation on image. It actually calls im-convolve with the following kernel:

```            -1/16  -1/8  -1/16      0  0  0
( * factor  -1/8    3/4  -1/8  ) +  0  1  0
-1/16  -1/8  -1/16      0  0  0
```

and uses `mirror` as the ‘out of bound strategy’.

Procedure: im-median-filter image w-width w-height [#:obs 'repeat]
Procedure: im-median-filter-channel channel width height w-width w-height [#:obs 'repeat]

Returns a new image or channel.

In the new image or channel, each pixel value is the ‘median’ value of neighboring entries. The pattern of neighbors is called a ‘window’, the size of which is given by `w-width` and `w-height` (see Median Filter for more information). Both w-width and w-height must be `odd` numbers, inferior to width and height respectively.

The optional keyword argument #:obs determines the ‘out-of-bound strategy’. Valid #:obs symbols are:

`avoid`

do not operate on pixels upon which (centering) the kernel does not fit in the image

`repeat`

repeat the nearest pixels

`mirror`

mirror the nearest pixels

`wrap`

wrap image around (periodic boundary conditions)

`zero`

out-of-bound pixel values to be `0.0`

Procedure: im-convolve image kernel [#:obs 'repeat]
Procedure: im-convolve-channel channel width height kernel k-width k-height [#:obs 'repeat]

Returns a new image or channel.

The new image or new channel is the result of the convolution of image using kernel. The kernel k-width and k-height values can be different, but they must be `odd` numbers, inferior to width and height respectively.

The optional keyword argument #:obs determines the ‘out-of-bound strategy’. Valid #:obs symbols are:

`avoid`

do not operate on pixels upon which (centering) the kernel does not fit in the image

`clip`

clip the kernel when operating on pixels upon which (centering) the kernel does not fit in the image (this is only useful if the kernel is >= 0 everywhere)

`repeat`

repeat the nearest pixels

`mirror`

mirror the nearest pixels

`wrap`

wrap image around (periodic boundary conditions)

`zero`

out-of-bound pixel values to be `0.0`

Kernel data structure, accessors, procedures and predefined kernels are all described in this node of the Guile-CV manual: Kernel Structure and Accessors.

Procedure: im-nl-means image arg...
Procedure: im-nl-means-channel channel width height arg...

Returns a new image or channel.

The new image or new channel is the result of a non-local means denoising as described here17. The following table lists the optional keyword arguments and their default values:

Policy arguments:

#:policy-type 1

accepts 0 (ratio policy) or 1 (norm policy)

#:sigma 15.0

default to 5.0 if the policy-type is 0

#:mean-ratio 5.0

default to 0.95 if the policy-type is 0

#:variance-ratio 0.5
#:epsilon 1.0e-5

Filter arguments:

#:spatial-sigma 2.0

the patch-radius can be either 1 or 2

#:mean-sigma 1.0
#:step-size 2
#:n-iteration 1

The `im-nl-means-channel` procedure accepts one additional optional keyword argument: