Convolve an image with an arbitrary filter mask.
convol_image convolves the input image Image with an arbitrary linear filter. The corresponding filter mask, which is given in FilterMask can be generated either from a file or a tuple. Several options for the treatment at the image's borders can be chosen (Margin):
gray value Pixels outside of the image edges
are assumed to be constant (with the
indicated gray value).
'continued' Continuation of edge pixels.
'cyclic' Cyclic continuation of image edges.
'mirrored' Reflection of pixels at the image edges.
All image points are convolved with the filter mask. If an overflow
or underflow occurs, the resulting gray value is clipped. Hence, if
filters that result in negative output values are used (e.g.,
derivative filters) the input image should be of type int2. If a
filename is given in FilterMask the filter mask is read from
a text file with the following structure:
<Mask size>
<Inverse weight of the mask>
<Matrix>
The first line contains the size of the filter mask, given as two
numbers separated by white space (e.g., 3 3 for 3 x 3).
Here, the first number defines the height of the filter mask, while
the second number defines its width. The next line contains the
inverse weight of the mask, i.e., the number by which the
convolution of a particular image point is divided. The remaining
lines contain the filter mask as integer numbers (separated by white
space), one line of the mask per line in the file. The file must
have the extension ``.fil''. This extension must not be passed to
the operator. If the filter mask is to be computed from a tuple, the
tuple given in FilterMask must also satisfy the structure
described above. However, in this case the line feed is omitted.
|
Image (input_object) |
(multichannel-)image(-array) -> object : byte / int2 / uint2 |
| Image to be convolved. | |
|
ImageResult (output_object) |
multichannel-image(-array) -> object : byte / int2 / uint2 |
| Convolved result image. | |
|
FilterMask (input_control) |
string(-array) -> string / integer |
| Filter mask as file name or tuple. | |
| Default value: 'sobel' | |
| Suggested values: 'sobel', 'laplace4', 'lowpas_3_3' | |
|
Margin (input_control) |
string -> string / integer / real |
| Border treatment. | |
| Default value: 'mirrored' | |
| Suggested values: 'mirrored', 'cyclic', 'continued', 0, 30, 60, 90, 120, 150, 180, 210, 240, 255 | |
convol_image is reentrant and automatically parallelized (on tuple level, channel level).
Image filters