ClassesClassesClassesClasses | | | | Operators

lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor (Operator)


lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor — Detect color lines and their width.


lines_color(Image : Lines : Sigma, Low, High, ExtractWidth, CompleteJunctions : )

Herror lines_color(const Hobject Image, Hobject* Lines, double Sigma, double Low, double High, const char* ExtractWidth, const char* CompleteJunctions)

Herror T_lines_color(const Hobject Image, Hobject* Lines, const Htuple Sigma, const Htuple Low, const Htuple High, const Htuple ExtractWidth, const Htuple CompleteJunctions)

Herror lines_color(Hobject Image, Hobject* Lines, const HTuple& Sigma, const HTuple& Low, const HTuple& High, const HTuple& ExtractWidth, const HTuple& CompleteJunctions)

HXLDContArray HImage::LinesColor(const HTuple& Sigma, const HTuple& Low, const HTuple& High, const HTuple& ExtractWidth, const HTuple& CompleteJunctions) const

void LinesColor(const HObject& Image, HObject* Lines, const HTuple& Sigma, const HTuple& Low, const HTuple& High, const HTuple& ExtractWidth, const HTuple& CompleteJunctions)

HXLDCont HImage::LinesColor(const HTuple& Sigma, const HTuple& Low, const HTuple& High, const HString& ExtractWidth, const HString& CompleteJunctions) const

HXLDCont HImage::LinesColor(double Sigma, double Low, double High, const HString& ExtractWidth, const HString& CompleteJunctions) const

HXLDCont HImage::LinesColor(double Sigma, double Low, double High, const char* ExtractWidth, const char* CompleteJunctions) const

void HOperatorSetX.LinesColor(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*Lines, [in] VARIANT Sigma, [in] VARIANT Low, [in] VARIANT High, [in] VARIANT ExtractWidth, [in] VARIANT CompleteJunctions)

IHXLDContX* HImageX.LinesColor(
[in] VARIANT Sigma, [in] VARIANT Low, [in] VARIANT High, [in] BSTR ExtractWidth, [in] BSTR CompleteJunctions)

static void HOperatorSet.LinesColor(HObject image, out HObject lines, HTuple sigma, HTuple low, HTuple high, HTuple extractWidth, HTuple completeJunctions)

HXLDCont HImage.LinesColor(HTuple sigma, HTuple low, HTuple high, string extractWidth, string completeJunctions)

HXLDCont HImage.LinesColor(double sigma, double low, double high, string extractWidth, string completeJunctions)


lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor extracts color lines from the input image ImageImageImageImageImageimage and returns the extracted lines as subpixel precise XLD-contours in LinesLinesLinesLinesLineslines. Color lines are defined as dark lines in the amplitude image of the color edge filter (see edges_coloredges_colorEdgesColoredges_colorEdgesColorEdgesColor). lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor always uses the Canny color edge filter. Hence, the required partial derivatives of the image are always computed by convolution with the respective partial derivatives of the Gaussian smoothing masks (see derivate_gaussderivate_gaussDerivateGaussderivate_gaussDerivateGaussDerivateGauss). The corresponding smoothing is determined by the parameter SigmaSigmaSigmaSigmaSigmasigma.

By defining color lines as dark lines in the amplitude image, in contrast to lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss, for single-channel images no distinction is made whether the lines are darker or brighter than their surroundings. Furthermore, lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor also returns staircase lines, i.e., lines for which the gray value of the lines lies between the gray values in the surrounding area to the left and right sides of the line. In multi-channel images, the above definition allows each channel to have a different line type. For example, in a three-channel image the first channel may have a dark line, the second channel a bright line, and the third channel a staircase line at the same position.

If ExtractWidthExtractWidthExtractWidthExtractWidthExtractWidthextractWidth is set to 'true'"true""true""true""true""true" the line width is extracted for each line point. Because the line extractor is unable to extract certain junctions because of differential geometric reasons, it tries to extract these by different means if CompleteJunctionsCompleteJunctionsCompleteJunctionsCompleteJunctionsCompleteJunctionscompleteJunctions is set to 'true'"true""true""true""true""true".

lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor links the line points into lines by using an algorithm similar to a hysteresis threshold operation, which is also used in lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss and edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPix. Points with an amplitude larger than HighHighHighHighHighhigh are immediately accepted as belonging to a line, while points with an amplitude smaller than LowLowLowLowLowlow are rejected. All other points are accepted as lines if they are connected to accepted line points (see also lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss). Here, amplitude means the line amplitude of the dark line (see lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss and lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet). This value corresponds to the third directional derivative of the smoothed input image in the direction perpendicular to the line.

For the choice of the thresholds HighHighHighHighHighhigh and LowLowLowLowLowlow one has to keep in mind that the third directional derivative depends on the amplitude and width of the line as well as the choice of SigmaSigmaSigmaSigmaSigmasigma. The value of the third derivative depends linearly on the amplitude, i.e., the larger the amplitude, the larger the response. For the width of the line there is an inverse dependence: The wider the line is, the smaller the response gets. This holds analogously for the dependence on SigmaSigmaSigmaSigmaSigmasigma: The larger SigmaSigmaSigmaSigmaSigmasigma is chosen, the smaller the second derivative will be. This means that for larger smoothing correspondingly smaller values for HighHighHighHighHighhigh and LowLowLowLowLowlow should be chosen.

The extracted lines are returned in a topologically sound data structure in LinesLinesLinesLinesLineslines. This means that lines are correctly split at junction points.

lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor defines the following attributes for each line point if ExtractWidthExtractWidthExtractWidthExtractWidthExtractWidthextractWidth was set to 'false'"false""false""false""false""false":


The angle of the direction perpendicular to the line (oriented such that the normal vectors point to the right side of the line as the line is traversed from start to end point; the angles are given with respect to the row axis of the image.)


The magnitude of the second derivative

If ExtractWidthExtractWidthExtractWidthExtractWidthExtractWidthextractWidth was set to 'true'"true""true""true""true""true", additionally the following attributes are defined:


The line width to the left of the line


The line width to the right of the line

All these attributes can be queried via the operator get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldget_contour_attrib_xldGetContourAttribXldGetContourAttribXld.


In general, but in particular if the line width is to be extracted, SigmaSigmaSigmaSigmaSigmasigma >= w/sqrt(3) should be selected, where w is the width (half the diameter) of the lines in the image. As the lowest allowable value SigmaSigmaSigmaSigmaSigmasigma >= w/2.5 must be selected. If, for example, lines with a width of 4 pixels (diameter 8 pixels) are to be extracted, SigmaSigmaSigmaSigmaSigmasigma >= 2.3 should be selected. If it is expected that staircase lines are present in at least one channel, and if such lines should be extracted, in addition to the above restriction, SigmaSigmaSigmaSigmaSigmasigma <= w should be selected. This is necessary because staircase lines turn into normal step edges for large amounts of smoothing, and therefore no longer appear as dark lines in the amplitude image of the color edge filter.



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

Input image.

LinesLinesLinesLinesLineslines (output_object)  xld_cont-array objectHXLDContHXLDContHXLDContArrayHXLDContXHobject *

Extracted lines.

SigmaSigmaSigmaSigmaSigmasigma (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Amount of Gaussian smoothing to be applied.

Default value: 1.5

Suggested values: 1, 1.2, 1.5, 1.8, 2, 2.5, 3, 4, 5

Typical range of values: 0.7 ≤ Sigma Sigma Sigma Sigma Sigma sigma ≤ 20

Recommended increment: 0.1

LowLowLowLowLowlow (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Lower threshold for the hysteresis threshold operation.

Default value: 3

Suggested values: 0, 0.5, 1, 2, 3, 4, 5, 8, 10

Typical range of values: 0 ≤ Low Low Low Low Low low

Recommended increment: 0.5

Restriction: Low >= 0

HighHighHighHighHighhigh (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Upper threshold for the hysteresis threshold operation.

Default value: 8

Suggested values: 0, 0.5, 1, 2, 3, 4, 5, 8, 10, 12, 15, 18, 20, 25

Typical range of values: 0 ≤ High High High High High high

Recommended increment: 0.5

Restriction: High >= 0 && High >= Low

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

Should the line width be extracted?

Default value: 'true' "true" "true" "true" "true" "true"

List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"

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

Should junctions be added where they cannot be extracted?

Default value: 'true' "true" "true" "true" "true" "true"

List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"


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


lines_colorlines_colorLinesColorlines_colorLinesColorLinesColor 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



lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss, lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet

See also

edges_coloredges_colorEdgesColoredges_colorEdgesColorEdgesColor, edges_color_sub_pixedges_color_sub_pixEdgesColorSubPixedges_color_sub_pixEdgesColorSubPixEdgesColorSubPix


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: “An Unbiased Detector of Curvilinear Structures”; IEEE Transactions on Pattern Analysis and Machine Intelligence; vol. 20, no. 2; pp. 113-125; 1998.
C. Steger: “Unbiased Extraction of Curvilinear Structures from 2D and 3D Images”; Herbert Utz Verlag, München; 1998.


2D Metrology

ClassesClassesClassesClasses | | | | Operators