edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPix (Operator)


edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPix — Extract subpixel precise color edges using Deriche, Shen, or Canny filters.


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

Herror edges_color_sub_pix(const Hobject Image, Hobject* Edges, const char* Filter, double Alpha, double Low, double High)

Herror T_edges_color_sub_pix(const Hobject Image, Hobject* Edges, const Htuple Filter, const Htuple Alpha, const Htuple Low, const Htuple High)

void EdgesColorSubPix(const HObject& Image, HObject* Edges, const HTuple& Filter, const HTuple& Alpha, const HTuple& Low, const HTuple& High)

HXLDCont HImage::EdgesColorSubPix(const HString& Filter, double Alpha, const HTuple& Low, const HTuple& High) const

HXLDCont HImage::EdgesColorSubPix(const HString& Filter, double Alpha, double Low, double High) const

HXLDCont HImage::EdgesColorSubPix(const char* Filter, double Alpha, double Low, double High) const

HXLDCont HImage::EdgesColorSubPix(const wchar_t* Filter, double Alpha, double Low, double High) const   (Windows only)

static void HOperatorSet.EdgesColorSubPix(HObject image, out HObject edges, HTuple filter, HTuple alpha, HTuple low, HTuple high)

HXLDCont HImage.EdgesColorSubPix(string filter, double alpha, HTuple low, HTuple high)

HXLDCont HImage.EdgesColorSubPix(string filter, double alpha, double low, double high)


edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPixEdgesColorSubPix extracts subpixel precise color edges from the input image ImageImageImageImageimage. The definition of color edges is given in the description of edges_coloredges_colorEdgesColorEdgesColorEdgesColor. The same edge filters as in edges_coloredges_colorEdgesColorEdgesColorEdgesColor can be selected: 'canny'"canny""canny""canny""canny", 'deriche1'"deriche1""deriche1""deriche1""deriche1", 'deriche2'"deriche2""deriche2""deriche2""deriche2", and 'shen'"shen""shen""shen""shen". In addition, a fast Sobel filter can be selected with 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast". The filters are specified by the parameter FilterFilterFilterFilterfilter.

The “filter width” (i.e., the amount of smoothing) can be chosen arbitrarily. For a detailed description of this parameter see edges_coloredges_colorEdgesColorEdgesColorEdgesColor. This parameter is ignored for FilterFilterFilterFilterfilter = 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast".

The extracted edges are returned as subpixel precise XLD contours in EdgesEdgesEdgesEdgesedges. For all edge operators except for 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast", the following attributes are defined for each edge point (see get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXld for further information):


Gives the direction of the edge (not of the XLD contour), calculated from the image gradients in horizontal and vertical direction. The angles [rad] are given with respect to the column axis of the image.


Direction of the normal vectors to the contour in radians (oriented such that the normal vectors point to the right side of the contour as the contour is traversed from start to end point; the angles are given with respect to the row axis of the image).


Edge amplitude (gradient magnitude).

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

Because edge extractors are often unable to extract certain junctions, a mode that tries to extract these missing junctions by different means can be selected by appending '_junctions'"_junctions""_junctions""_junctions""_junctions" to the values of FilterFilterFilterFilterfilter that are described above. This mode is analogous to the mode for completing junctions that is available in edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix and lines_gausslines_gaussLinesGaussLinesGaussLinesGauss.

The edge operator 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast" has the same semantics as all the other edge operators. Internally, however, it is based on significantly simplified variants of the individual processing steps (hysteresis thresholding, edge point linking, and extraction of the subpixel edge positions). Therefore, 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast" in some cases may return slightly less accurate edge positions and may select different edge parts.


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


ImageImageImageImageimage (input_object)  (multichannel-)image objectHImageHImageHobject (byte / uint2)

Input image.

EdgesEdgesEdgesEdgesedges (output_object)  xld_cont-array objectHXLDContHXLDContHobject *

Extracted edges.

FilterFilterFilterFilterfilter (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Edge operator to be applied.

Default value: 'canny' "canny" "canny" "canny" "canny"

List of values: 'canny'"canny""canny""canny""canny", 'canny_junctions'"canny_junctions""canny_junctions""canny_junctions""canny_junctions", 'deriche1'"deriche1""deriche1""deriche1""deriche1", 'deriche1_junctions'"deriche1_junctions""deriche1_junctions""deriche1_junctions""deriche1_junctions", 'deriche2'"deriche2""deriche2""deriche2""deriche2", 'deriche2_junctions'"deriche2_junctions""deriche2_junctions""deriche2_junctions""deriche2_junctions", 'shen'"shen""shen""shen""shen", 'shen_junctions'"shen_junctions""shen_junctions""shen_junctions""shen_junctions", 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast"

AlphaAlphaAlphaAlphaalpha (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Filter parameter: small values result in strong smoothing, and thus less detail (opposite for 'canny').

Default value: 1.0

Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.0, 1.1, 1.2, 1.5, 2.0, 2.5, 3.0

Typical range of values: 0.7 ≤ Alpha Alpha Alpha Alpha alpha ≤ 50.0

Minimum increment: 0.01

Recommended increment: 0.1

Restriction: Alpha > 0.0

LowLowLowLowlow (input_control)  number HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

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 Low Low Low low

Minimum increment: 1

Recommended increment: 5

Restriction: Low > 0

HighHighHighHighhigh (input_control)  number HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

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 High High High high

Minimum increment: 1

Recommended increment: 5

Restriction: High > 0 && High >= Low


The amount of temporary memory required is dependent on the height H of the domain of ImageImageImageImageimage.


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



See also

edges_imageedges_imageEdgesImageEdgesImageEdgesImage, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix, info_edgesinfo_edgesInfoEdgesInfoEdgesInfoEdges, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdHysteresisThresholdHysteresisThreshold, lines_gausslines_gaussLinesGaussLinesGaussLinesGauss, lines_facetlines_facetLinesFacetLinesFacetLinesFacet


C. Steger: “Subpixel-Precise Extraction of Lines and Edges”; International Archives of Photogrammetry and Remote Sensing, vol. XXXIII, part B3; pp. 141-156; 2000.
C. Steger: “Unbiased Extraction of Curvilinear Structures from 2D and 3D Images”; Herbert Utz Verlag, München; 1998.
S. Di Zenzo: “A Note on the Gradient of a Multi-Image”; Computer Vision, Graphics, and Image Processing, vol. 33; pp. 116-125; 1986.
Aldo Cumani: “Edge Detection in Multispectral Images”; Computer Vision, Graphics, and Image Processing: Graphical Models and Image Processing, vol. 53, no. 1; pp. 40-51; 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; pp. 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; pp. 167-187; 1987.
R.Deriche: “Fast Algorithms for Low-Level Vision”; IEEE Transactions on Pattern Analysis and Machine Intelligence; PAMI-12, no. 1; pp. 78-87; 1990.
J. Shen, S. Castan: “An Optimal Linear Operator for Step Edge Detection”; Computer Vision, Graphics, and Image Processing: Graphical Models and Image Processing, vol. 54, no. 2; pp. 112-133; 1992.


2D Metrology