edges_sub_pix ( Image : Edges : Filter, Alpha, Low, High : )

Extract sub-pixel precise edges using Deriche, Lanser, Shen, or Canny filters.

edges_sub_pix detects step edges using recursively implemented filters (according to Deriche, Lanser and Shen) or the conventionally implemented ``derivative of Gaussian'' filter (using filter masks) proposed by Canny. Thus, the following edge operators are available:

'deriche1', 'lanser1', 'deriche1_int4', 'deriche2', 'lanser2', 'lanser2_int4', 'shen', 'mshen', and 'canny'

(parameter Filter).

The extracted edges are returned as sub-pixel precise XLD contours in Edges. For each edge point the following attributes are defined (see get_contour_attrib_xld):

  'angle':        Edge direction (modulo PI)
  'response':     Edge amplitude (gradient magnitude)

The ``filter width'' (i.e., the amount of smoothing) can be chosen arbitrarily, and can be estimated by calling info_edges for concrete values of the parameter Alpha. It decreases for increasing Alpha for the Deriche, Lanser and Shen filters and increases for the Canny filter, where it is the standard deviation of the Gaussian on which the Canny operator is based. ``Wide'' filters exhibit a larger invariance to noise, but also a decreased ability to detect small details. Non-recursive filters, such as the Canny filter, are realized using filter masks, and thus the execution time increases for increasing filter width. In contrast, the execution time for recursive filters does not depend on the filter width. Thus, arbitrary filter widths are possible using the Deriche, Lanser and Shen filters without increasing the run time of the operator. The resulting advantage in speed compared to the Canny operator naturally increases for larger filter widths. As border treatment, the recursive operators assume that the images to be zero outside of the image, while the Canny operator repeats the gray value at the image's border. Comparable filter widths can be obtained by the following choices of Alpha:

     Alpha('lanser1')   = Alpha('deriche1') / 2,
     Alpha('deriche2')  = Alpha('deriche1') / 2,
     Alpha('lanser2')   = Alpha('deriche1') / 2,
     Alpha('shen')      = Alpha('deriche1') / 2,
     Alpha('mshen')     = Alpha('deriche1') / 2,
     Alpha('gauss')     = 1.77 / Alpha('deriche1').
The originally proposed recursive filters ('deriche1', 'deriche2', 'shen') return a biased estimate of the amplitude of diagonal edges. This bias is removed in the corresponding modified version of the operators ('lanser1', 'lanser2' und 'mshen'), while maintaining the same execution speed.

For relatively small filter widths (11 x 11), i.e., for Alpha ('lanser2' = 0.5), all filters yield similar results. Only for ``wider'' filters differences begin to appear: the Shen filters begin to yield qualitatively inferior results. However, they are the fastest of the implemented operators --- closely followed by the Deriche operators.

edges_sub_pix links the edge points into edges by using an algorithm similar to a hysteresis threshold operation, which is also used in lines_gauss. Points with an amplitude larger than High are immediately accepted as belonging to an edge, while points with an amplitude smaller than Low are rejected. All other points are accepted as edges if they are connected to accepted edge points (see also lines_gauss and hysteresis_threshold).


Image (input_object)
image -> object : byte
Input image.

Edges (output_object)
xld_cont-array -> object
Extracted edges.

Filter (input_control)
string -> string
Edge operator to be applied.
Default value: 'lanser2'
List of values: 'deriche1', 'lanser1', 'deriche2', 'lanser2', 'shen', 'mshen', 'canny', 'sobel'

Alpha (input_control)
real -> real
Filter parameter: small values result in strong smoothing, and thus less detail (opposite for 'canny').
Default value: 0.5
Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1
Typical range of values: 0.2 <= Alpha <= 50.0
Minimum increment: 0.01
Recommended increment: 0.1
Restriction: Alpha > 0.0

Low (input_control)
integer -> integer
Lower threshold for the hysteresis threshold operation.
Default value: 20
Suggested values: 5, 10, 15, 20, 25, 30, 40
Typical range of values: 1 <= Low <= 255
Minimum increment: 1
Recommended increment: 5
Restriction: Low > 0

High (input_control)
integer -> integer
Upper threshold for the hysteresis threshold operation.
Default value: 40
Suggested values: 10, 15, 20, 25, 30, 40, 50, 60, 70
Typical range of values: 1 <= High <= 255
Minimum increment: 1
Recommended increment: 5
Restriction: (High > 0) && (High >= Low)



edges_sub_pix returns 2 (H_MSG_TRUE) if all parameters are correct and no error occurs during execution. If the input is empty the behaviour can be set via set_system('no_object_result',<Result>). If necessary, an exception handling is raised.

Parallelization Information

edges_sub_pix is reentrant and automatically parallelized (on tuple level).


sobel_dir, frei_dir, kirsch_dir, prewitt_dir, robinson_dir, edges_image

See also

info_edges, hysteresis_threshold, bandpass_image, lines_gauss, lines_facet


S.Lanser, W.Eckstein: ``Eine Modifikation des Deriche-Verfahrens zur Kantendetektion''; 13. DAGM-Symposium, Munchen; Informatik Fachberichte 290; Seite 151 - 158; Springer-Verlag; 1991.

S.Lanser: ``Detektion von Stufenkanten mittels rekursiver Filter nach Deriche''; Diplomarbeit; Technische Universitat Munchen, Institut fur Informatik, Lehrstuhl Prof. Radig; 1991.

J.Canny: ``Finding Edges and Lines in Images''; Report, AI-TR-720; M.I.T. Artificial Intelligence Lab., Cambridge; 1983.

J.Canny: ``A Computational Approach to Edge Detection''; IEEE Transactions on Pattern Analysis and Machine Intelligence; PAMI-8, vol. 6; S. 679-698; 1986.

R.Deriche: ``Using Canny's Criteria to Derive a Recursively Implemented Optimal Edge Detector''; International Journal of Computer Vision; vol. 1, no. 2; S. 167-187; 1987.

R.Deriche: ``Optimal Edge Detection Using Recursive Filtering''; Proc. of the First International Conference on Computer Vision, London; S. 501-505; 1987.

R.Deriche: ``Fast Algorithms for Low-Level Vision''; IEEE Transactions on Pattern Analysis and Machine Intelligence; PAMI-12, no. 1; S. 78-87; 1990.

S.Castan, J.Zhao und J.Shen: ``Optimal Filter for Edge Detection Methods and Results''; Proc. of the First European Conference on Computer Vision, Antibes; Lecture Notes on computer Science; no. 427; S. 12-17; Springer-Verlag; 1990.


Sub-pixel operators

Copyright 1996-2000 MVTec Software GmbH