sobel_amp — Detect edges (amplitude) using the Sobel operator.
sobel_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 -1These 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.)
sobel_amp(I,E,FilterType,S) for Size > 3 is conceptually equivalent to scale_image(I,F,2,0) gauss_image(F,G,S-2) sobel_amp(G,E,FilterType,3) or to scale_image(I,F,2,0) binomial_filter(F,G,S-2,S-2) sobel_amp(G,E,FilterType,3).
For sobel_amp special optimizations are implemented FilterType = 'sum_abs' that use SIMD technology. The actual application of these special optimizations is controlled by the system parameter 'mmx_enable' (see set_system). If 'mmx_enable' is set to '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_amp might even take significantly more time with SIMD technology than without.
sobel_amp can be executed on OpenCL devices for the filter types 'sum_abs', 'sum_sqrt', 'x' and 'y' (as well as their binomial variants). Note that when using gaussian filtering for Size > 3, the results can vary from the CPU implementation.
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.
Edge amplitude (gradient magnitude) image.
Default value: 'sum_abs'
List of values: 'sum_abs', 'sum_abs_binomial', 'sum_sqrt', 'sum_sqrt_binomial', 'thin_max_abs', 'thin_max_abs_binomial', 'thin_sum_abs', 'thin_sum_abs_binomial', 'x', 'x_binomial', 'y', 'y_binomial'
List of values (for compute devices): 'sum_abs', 'sum_sqrt', 'x', 'y', 'sum_abs_binomial', 'sum_sqrt_binomial', 'x_binomial', 'y_binomial'
Size of filter mask.
Default value: 3
List of values: 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39
read_image(Image,'fabrik') sobel_amp(Image,Amp,'sum_abs',3) threshold(Amp,Edg,128,255)
sobel_amp returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system('no_object_result',<Result>). If necessary, an exception is raised.
binomial_filter, gauss_filter, mean_image, anisotropic_diffusion, sigma_image
threshold, nonmax_suppression_amp, gray_skeleton
frei_amp, roberts, kirsch_amp, prewitt_amp, robinson_amp
laplace, highpass_image, bandpass_image