edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPixedges_color_sub_pix (Operator)

Name

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

Signature

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)

def edges_color_sub_pix(image: HObject, filter: str, alpha: float, low: Union[float, int], high: Union[float, int]) -> HObject

Description

edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPixEdgesColorSubPixedges_color_sub_pix extracts subpixel precise color edges from the input image ImageImageImageImageimageimage. The definition of color edges is given in the description of edges_coloredges_colorEdgesColorEdgesColorEdgesColoredges_color. The same edge filters as in edges_coloredges_colorEdgesColorEdgesColorEdgesColoredges_color can be selected: 'canny'"canny""canny""canny""canny""canny", 'deriche1'"deriche1""deriche1""deriche1""deriche1""deriche1", 'deriche2'"deriche2""deriche2""deriche2""deriche2""deriche2", and 'shen'"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""sobel_fast". The filters are specified by the parameter FilterFilterFilterFilterfilterfilter.

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

The extracted edges are returned as subpixel precise XLD contours in EdgesEdgesEdgesEdgesedgesedges. For all edge operators except for 'sobel_fast'"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_xldGetContourAttribXldGetContourAttribXldGetContourAttribXldget_contour_attrib_xld for further information):

'edge_direction'"edge_direction""edge_direction""edge_direction""edge_direction""edge_direction":

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.

'angle'"angle""angle""angle""angle""angle":

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).

'response'"response""response""response""response""response":

Edge amplitude (gradient magnitude).

edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPixEdgesColorSubPixedges_color_sub_pix 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_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix and lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss. Points with an amplitude larger than HighHighHighHighhighhigh are immediately accepted as belonging to an edge, while points with an amplitude smaller than LowLowLowLowlowlow are rejected. All other points are accepted as edges if they are connected to accepted edge points (see also lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss and hysteresis_thresholdhysteresis_thresholdHysteresisThresholdHysteresisThresholdHysteresisThresholdhysteresis_threshold).

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""_junctions" to the values of FilterFilterFilterFilterfilterfilter that are described above. This mode is analogous to the mode for completing junctions that is available in edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix and lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss.

The edge operator 'sobel_fast'"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""sobel_fast" in some cases may return slightly less accurate edge positions and may select different edge parts.

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

Parameters

ImageImageImageImageimageimage (input_object)  (multichannel-)image objectHImageHObjectHImageHobject (byte / uint2)

Input image.

EdgesEdgesEdgesEdgesedgesedges (output_object)  xld_cont-array objectHXLDContHObjectHXLDContHobject *

Extracted edges.

FilterFilterFilterFilterfilterfilter (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Edge operator to be applied.

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

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

AlphaAlphaAlphaAlphaalphaalpha (input_control)  real HTuplefloatHTupleHtuple (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 alpha ≤ 50.0

Minimum increment: 0.01

Recommended increment: 0.1

Restriction: Alpha > 0.0

LowLowLowLowlowlow (input_control)  number HTupleUnion[float, int]HTupleHtuple (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 low

Minimum increment: 1

Recommended increment: 5

Restriction: Low > 0

HighHighHighHighhighhigh (input_control)  number HTupleUnion[float, int]HTupleHtuple (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 high

Minimum increment: 1

Recommended increment: 5

Restriction: High > 0 && High >= Low

Complexity

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

Result

edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPixEdgesColorSubPixedges_color_sub_pix 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>)set_system("no_object_result",<Result>). If necessary, an exception is raised.

Alternatives

edges_coloredges_colorEdgesColorEdgesColorEdgesColoredges_color

See also

edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix, info_edgesinfo_edgesInfoEdgesInfoEdgesInfoEdgesinfo_edges, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdHysteresisThresholdHysteresisThresholdhysteresis_threshold, lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss, lines_facetlines_facetLinesFacetLinesFacetLinesFacetlines_facet

References

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.

Module

2D Metrology