Convolvesan array with a kernel (or another array).
kernel The array used to convolve each value in array. The dimensions of kernel must be smaller than those of array, but they can be of any data type except string. (If a string array is used, PV-WAVE will attempt to convert it and then issue an error message.)
scale_factor (optional) A scaling factor that reduces each output value by the specified factor. The scale_factor parameter can be used with integer and byte type data only. (Default: 1.0)
Edge A scalar string indicating how edge effects are handled. (Default:
'zero'
) Valid strings are:
'zero'
Sets the border of the output image to zero. (Default)
'copy'
Copies the border of the input image to the output image.
TIP: When using CONVOL with image data, make sure the data has been first converted to floating-point type.
Using the scale_factor parameter allows you to simulate fractional kernel values and avoid overflow with byte parameters.
In many signal and image processing applications, it is useful to center a symmetric kernel over the data, to align the result with the original array. The Center keyword controls the alignment of the kernel with the array and the ordering of the kernel elements.
In terms of CONVOL parameters, s corresponds to array and r corresponds to kernel. The effect of convolution is to smear the signal s(t) in time according to the "recipe" provided by the response function r(t).
R = CONVOL(A, K, S)
A
is an n-element vector, K
is an m-element vector (m n), and S
is the scale factor.
R = CONVOL(A, K, S)
A
is an m-by-n element array, K
is an l-by-l element kernel, S
is the scale factor, and the result R
is an m-by-n element array.
result = CONVOL(mandril_img, kernel, /Center)
kernel
is a 3-by-3 array. This array has the following value:
This kernel value represents a commonly-used algorithm for edge enhancement.
Figure 2-23 The CONVOL function has been used to enhance the edges of this 512-by-512 mandrill image. In other words, after CONVOL is applied, the dark colors change quickly to light ones.
Figure 2-24 The CONVOL function has been used to enhance the edges of this 512-by-512 mandrill image. In other words, after CONVOL is applied, the dark colors change quickly to light ones.
For more information on displaying images, see the PV-WAVE User's Guide.
For a signal processing example, see the DIGITAL_FILTER Example section.