ClassesClassesClassesClasses | | | | Operators

edges_coloredges_colorEdgesColoredges_colorEdgesColorEdgesColor (Operator)

Name

edges_coloredges_colorEdgesColoredges_colorEdgesColorEdgesColor — Extract color edges using Canny, Deriche, or Shen filters.

Signature

edges_color(Image : ImaAmp, ImaDir : Filter, Alpha, NMS, Low, High : )

Herror edges_color(const Hobject Image, Hobject* ImaAmp, Hobject* ImaDir, const char* Filter, double Alpha, const char* NMS, const Hlong Low, const Hlong High)

Herror T_edges_color(const Hobject Image, Hobject* ImaAmp, Hobject* ImaDir, const Htuple Filter, const Htuple Alpha, const Htuple NMS, const Htuple Low, const Htuple High)

Herror edges_color(Hobject Image, Hobject* ImaAmp, Hobject* ImaDir, const HTuple& Filter, const HTuple& Alpha, const HTuple& NMS, const HTuple& Low, const HTuple& High)

HImage HImage::EdgesColor(HImage* ImaDir, const HTuple& Filter, const HTuple& Alpha, const HTuple& NMS, const HTuple& Low, const HTuple& High) const

HImageArray HImageArray::EdgesColor(HImageArray* ImaDir, const HTuple& Filter, const HTuple& Alpha, const HTuple& NMS, const HTuple& Low, const HTuple& High) const

void EdgesColor(const HObject& Image, HObject* ImaAmp, HObject* ImaDir, const HTuple& Filter, const HTuple& Alpha, const HTuple& NMS, const HTuple& Low, const HTuple& High)

HImage HImage::EdgesColor(HImage* ImaDir, const HString& Filter, double Alpha, const HString& NMS, Hlong Low, Hlong High) const

HImage HImage::EdgesColor(HImage* ImaDir, const char* Filter, double Alpha, const char* NMS, Hlong Low, Hlong High) const

void HOperatorSetX.EdgesColor(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*ImaAmp, [out] IHUntypedObjectX*ImaDir, [in] VARIANT Filter, [in] VARIANT Alpha, [in] VARIANT NMS, [in] VARIANT Low, [in] VARIANT High)

IHImageX* HImageX.EdgesColor(
[out] IHImageX*ImaDir, [in] BSTR Filter, [in] double Alpha, [in] BSTR NMS, [in] Hlong Low, [in] Hlong High)

static void HOperatorSet.EdgesColor(HObject image, out HObject imaAmp, out HObject imaDir, HTuple filter, HTuple alpha, HTuple NMS, HTuple low, HTuple high)

HImage HImage.EdgesColor(out HImage imaDir, string filter, double alpha, string NMS, int low, int high)

Description

edges_coloredges_colorEdgesColoredges_colorEdgesColorEdgesColor extracts color edges from the input image ImageImageImageImageImageimage. To define color edges, the multi-channel image ImageImageImageImageImageimage is regarded as a mapping , where n is the number of channels in ImageImageImageImageImageimage. For such functions, there is a natural extension of the gradient: the metric tensor G, which can be used to calculate for every direction, given by the direction vector v, the rate of change of f in the direction v. For notational convenience, G will be regarded as a two-dimensional matrix. Thus, the rate of change of the function f in the direction v is given by v^T G v, where

The partial derivatives of the images, which are necessary to calculate the metric tensor, are calculated with the corresponding edge filters, analogously to edges_imageedges_imageEdgesImageedges_imageEdgesImageEdgesImage. For FilterFilterFilterFilterFilterfilter = 'canny'"canny""canny""canny""canny""canny", the partial derivatives of the Gaussian smoothing masks are used (see derivate_gaussderivate_gaussDerivateGaussderivate_gaussDerivateGaussDerivateGauss), for 'deriche1'"deriche1""deriche1""deriche1""deriche1""deriche1" and FilterFilterFilterFilterFilterfilter = 'deriche2'"deriche2""deriche2""deriche2""deriche2""deriche2" the corresponding Deriche filters, for FilterFilterFilterFilterFilterfilter = 'shen'"shen""shen""shen""shen""shen" the corresponding Shen filters, and for FilterFilterFilterFilterFilterfilter = 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast""sobel_fast" the Sobel filter. Analogously to single-channel images, the gradient direction is defined by the vector v in which the rate of change f is maximum. The vector v is given by the eigenvector corresponding to the largest eigenvalue of G. The square root of the eigenvalue is the equivalent of the gradient magnitude (the amplitude) for single-channel images, and is returned in ImaAmpImaAmpImaAmpImaAmpImaAmpimaAmp. For single-channel images, both definitions are equivalent. Since the gradient magnitude may be larger than what can be represented in the input image data type (byte or uint2), it is stored in the next larger data type (uint2 or int4) in ImaAmpImaAmpImaAmpImaAmpImaAmpimaAmp. The eigenvector also is used to define the edge direction. In contrast to single-channel images, the edge direction can only be defined modulo 180 degrees. Like in the output of edges_imageedges_imageEdgesImageedges_imageEdgesImageEdgesImage, the edge directions are stored in 2-degree steps, and are returned in ImaDirImaDirImaDirImaDirImaDirimaDir. Points with edge amplitude 0 are assigned the edge direction 255 (undefined direction). For speed reasons, the edge directions are not computed explicitly for FilterFilterFilterFilterFilterfilter = 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast""sobel_fast". Therefore, ImaDirImaDirImaDirImaDirImaDirimaDir is an empty object in this case.

The “filter width” (i.e., the amount of smoothing) can be chosen arbitrarily for all filters except 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast""sobel_fast" (where the filter width is 3x3 and AlphaAlphaAlphaAlphaAlphaalpha is ignored), and can be estimated by calling info_edgesinfo_edgesInfoEdgesinfo_edgesInfoEdgesInfoEdges for concrete values of the parameter AlphaAlphaAlphaAlphaAlphaalpha. It decreases for increasing AlphaAlphaAlphaAlphaAlphaalpha for the Deriche 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 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 are zero outside of the image, while the Canny operator mirrors the gray value at the image border. The signal-noise-ratio of the filters is comparable for the following choices of AlphaAlphaAlphaAlphaAlphaalpha:

     Alpha('deriche2')  = Alpha('deriche1') / 2,
     Alpha('shen')      = Alpha('deriche1') / 2,
     Alpha('canny')     = 1.77 / Alpha('deriche1').

edges_coloredges_colorEdgesColoredges_colorEdgesColorEdgesColor optionally offers to apply a non-maximum-suppression (NMSNMSNMSNMSNMSNMS = 'nms'"nms""nms""nms""nms""nms"/'inms'"inms""inms""inms""inms""inms"/'hvnms'"hvnms""hvnms""hvnms""hvnms""hvnms"; 'none'"none""none""none""none""none" if not desired) and hysteresis threshold operation (LowLowLowLowLowlow,HighHighHighHighHighhigh; at least one negative if not desired) to the resulting edge image. Conceptually, this corresponds to the following calls:

         nonmax_suppression_dir(...,NMS,...)
         hysteresis_threshold(...,Low,High,1000,...).

Note that the hysteresis threshold operation is not applied if NMSNMSNMSNMSNMSNMS is set to 'none'.

For 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast""sobel_fast", the same non-maximum-suppression is performed for all values of NMSNMSNMSNMSNMSNMS except 'none'"none""none""none""none""none". Additionally, for 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast""sobel_fast" the resulting edges are thinned to a width of one pixel.

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.

Parallelization

Parameters

ImageImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHImageHImageXHobject (byte / uint2)

Input image.

ImaAmpImaAmpImaAmpImaAmpImaAmpimaAmp (output_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject * (uint2 / int4)

Edge amplitude (gradient magnitude) image.

ImaDirImaDirImaDirImaDirImaDirimaDir (output_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject * (direction)

Edge direction image.

FilterFilterFilterFilterFilterfilter (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Edge operator to be applied.

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

List of values: 'canny'"canny""canny""canny""canny""canny", 'deriche1'"deriche1""deriche1""deriche1""deriche1""deriche1", 'deriche2'"deriche2""deriche2""deriche2""deriche2""deriche2", 'shen'"shen""shen""shen""shen""shen", 'sobel_fast'"sobel_fast""sobel_fast""sobel_fast""sobel_fast""sobel_fast"

AlphaAlphaAlphaAlphaAlphaalpha (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (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.2 ≤ Alpha Alpha Alpha Alpha Alpha alpha ≤ 50.0

Minimum increment: 0.01

Recommended increment: 0.1

Restriction: Alpha > 0.0

NMSNMSNMSNMSNMSNMS (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Non-maximum suppression ('none', if not desired).

Default value: 'nms' "nms" "nms" "nms" "nms" "nms"

List of values: 'hvnms'"hvnms""hvnms""hvnms""hvnms""hvnms", 'inms'"inms""inms""inms""inms""inms", 'nms'"nms""nms""nms""nms""nms", 'none'"none""none""none""none""none"

LowLowLowLowLowlow (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Lower threshold for the hysteresis threshold operation (negative if no thresholding is desired).

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 >= 1 || Low < 0

HighHighHighHighHighhigh (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Upper threshold for the hysteresis threshold operation (negative if no thresholding is desired).

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 >= 1 || High < 0 && High >= Low

Result

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

Possible Successors

thresholdthresholdThresholdthresholdThresholdThreshold

Alternatives

edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPix

See also

edges_imageedges_imageEdgesImageedges_imageEdgesImageEdgesImage, edges_sub_pixedges_sub_pixEdgesSubPixedges_sub_pixEdgesSubPixEdgesSubPix, info_edgesinfo_edgesInfoEdgesinfo_edgesInfoEdgesInfoEdges, nonmax_suppression_ampnonmax_suppression_ampNonmaxSuppressionAmpnonmax_suppression_ampNonmaxSuppressionAmpNonmaxSuppressionAmp, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdhysteresis_thresholdHysteresisThresholdHysteresisThreshold

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

Foundation


ClassesClassesClassesClasses | | | | Operators