Detect edges (amplitude) using the Sobel operator.
sobel_dir 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 und b denote the results of convolving an image with A und B for one particular pixel.) 'sum_sqrt' sqrt(a^2 + b^2) 'sum_abs' (|a| + |b|) / 2 'thin_sum_abs' (thin(|a|) + thin(|b|)) / 2 'thin_max_abs' max(thin(|a|),thin(|b|)) 'x' b + 127 'y' a + 127 'x_int4' b 'y_int4' a 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' and 'thin_max_abs' the gradient image is thinned. For 'sum_abs', 'sum_sqrt', 'x' and 'y', sobel_amp returns a byte-image, while for 'x_int4' and 'y_int4' it returns an int4-image. For a Sobel operator with size 3x3, the corresponding filters A and B are applied directly, while for larger filter sizes (Size = 5,7,9 and 11) the input image is first smoothed using a Gaussian filter of size Size-2. Therefore,
sobel_amp(I:E:FilterType,S) for Size > 3 is equivalent to gauss__(I:G:S-2) > sobel_amp(G:E:FilterType,3).
Image (input_object) |
image(-array) -> object : byte |
Input image. |
EdgeAmplitude (output_object) |
image(-array) -> object : byte / int4 |
Edge amplitude (gradient magnitude) image. |
FilterType (input_control) |
string -> string |
Filter type. | |
Default value: 'sum_abs' | |
List of values: 'sum_abs', 'thin_sum_abs', 'thin_max_abs', 'sum_sqrt', 'x', 'y', 'x_int4', 'y_int4', 'sum_abs_real' |
Size (input_control) |
integer -> integer |
Size of filter mask. | |
Default value: 3 | |
List of values: 3, 5, 7, 9, 11, 13 |
read_image(:Image:'fabrik':) > sobel_amp(Image:Amp:'sum_abs',3:) > threshold__(Amp:Edg:128,255:).
sobel_amp returns TRUE if all parameters are correct. If the input is empty the behaviour can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.
gauss__, mean__, anisotrope_diff__, sigma__
threshold__, nonmax_suppression_amp, grey_skeleton__
frei_amp, roberts__, kirsch_amp, prewitt_amp, robinson_amp
laplace__, highpass__, bandpass__