sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp calculates first derivative of an image and is
used as an edge detector. The filter is based on the following
filter masks:
A =
1 2 1
0 0 0
-1 -2 -1
B =
1 0 -1
2 0 -2
1 0 -1
These masks are used differently, according to the selected filter
type. (In the following, a and b denote the results of
convolving an image with A and B for one particular pixel.)
Here, thin(x) is equal to x for a vertical
maximum (mask A) and a horizontal maximum (mask B), respectively,
and 0 otherwise. Thus, for 'thin_sum_abs'"thin_sum_abs""thin_sum_abs""thin_sum_abs""thin_sum_abs""thin_sum_abs" and 'thin_max_abs'"thin_max_abs""thin_max_abs""thin_max_abs""thin_max_abs""thin_max_abs"
the gradient image is thinned. For the filter types 'x'"x""x""x""x""x" and
'y'"y""y""y""y""y" if the input image is of type byte the output image is
of type int1, of type int2 otherwise. For a Sobel operator with
size 3x3, the corresponding filters A and B are
applied directly, while for larger filter sizes the input image is
first smoothed using a Gaussian filter (see gauss_imagegauss_imageGaussImageGaussImageGaussImagegauss_image) or
a binomial filter (see binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter) of size
SizeSizeSizeSizesizesize-2. The Gaussian filter is selected for the above
values of FilterTypeFilterTypeFilterTypeFilterTypefilterTypefilter_type. Here, SizeSizeSizeSizesizesize = 5, 7, 9, 11,
or 13 must be used. The binomial filter is selected by appending
'_binomial'"_binomial""_binomial""_binomial""_binomial""_binomial" to the above values of FilterTypeFilterTypeFilterTypeFilterTypefilterTypefilter_type.
Here, SizeSizeSizeSizesizesize can be selected between 5 and 39. Furthermore,
it is possible to select different amounts of smoothing the
column and row direction by passing two values in SizeSizeSizeSizesizesize.
Here, the first value of SizeSizeSizeSizesizesize corresponds to the mask width
(smoothing in the column direction), while the second value
corresponds to the mask height (smoothing in the row direction) of
the binomial filter. The binomial filter can only be used for
images of type byte, uint2 and real. Since smoothing reduces the edge
amplitudes, in this case the edge amplitudes are multiplied by a
factor of 2 to prevent information loss. Therefore,
For sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp special optimizations are implemented
FilterTypeFilterTypeFilterTypeFilterTypefilterTypefilter_type = 'sum_abs'"sum_abs""sum_abs""sum_abs""sum_abs""sum_abs" that use SIMD technology.
The actual application of these special optimizations is controlled
by the system parameter 'sse2_enable'"sse2_enable""sse2_enable""sse2_enable""sse2_enable""sse2_enable" and 'avx2_enable'"avx2_enable""avx2_enable""avx2_enable""avx2_enable""avx2_enable",
respectively (see set_systemset_systemSetSystemSetSystemSetSystemset_system). If 'sse2_enable'"sse2_enable""sse2_enable""sse2_enable""sse2_enable""sse2_enable" or
'avx2_enable'"avx2_enable""avx2_enable""avx2_enable""avx2_enable""avx2_enable"is set to 'true'"true""true""true""true""true"
(and the SIMD instruction set is available), the internal calculations are
performed using SIMD technology.
Note that SIMD technology performs best on large, compact input regions.
Depending on the input region and the capabilities of the hardware
the execution of sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp might even take significantly
more time with SIMD technology than without.
sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp can be executed on OpenCL devices for the filter
types 'sum_abs'"sum_abs""sum_abs""sum_abs""sum_abs""sum_abs", 'sum_sqrt'"sum_sqrt""sum_sqrt""sum_sqrt""sum_sqrt""sum_sqrt", 'x'"x""x""x""x""x" and 'y'"y""y""y""y""y"
(as well as their binomial variants). Note that when using gaussian
filtering for SizeSizeSizeSizesizesize > 3, the results can vary from the CPU
implementation.
Attention
Note that filter operators may return unexpected results if
an image with a reduced domain is used as input. Please refer to the
chapter Filters.
Execution Information
Supports OpenCL compute devices.
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).