ClassesClassesClassesClasses | | | | Operators

lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet (Operator)

Name

lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet — Detection of lines using the facet model.

Signature

lines_facet(Image : Lines : MaskSize, Low, High, LightDark : )

Herror lines_facet(const Hobject Image, Hobject* Lines, const Hlong MaskSize, double Low, double High, const char* LightDark)

Herror T_lines_facet(const Hobject Image, Hobject* Lines, const Htuple MaskSize, const Htuple Low, const Htuple High, const Htuple LightDark)

Herror lines_facet(Hobject Image, Hobject* Lines, const HTuple& MaskSize, const HTuple& Low, const HTuple& High, const HTuple& LightDark)

HXLDContArray HImage::LinesFacet(const HTuple& MaskSize, const HTuple& Low, const HTuple& High, const HTuple& LightDark) const

void LinesFacet(const HObject& Image, HObject* Lines, const HTuple& MaskSize, const HTuple& Low, const HTuple& High, const HTuple& LightDark)

HXLDCont HImage::LinesFacet(Hlong MaskSize, const HTuple& Low, const HTuple& High, const HString& LightDark) const

HXLDCont HImage::LinesFacet(Hlong MaskSize, double Low, double High, const HString& LightDark) const

HXLDCont HImage::LinesFacet(Hlong MaskSize, double Low, double High, const char* LightDark) const

void HOperatorSetX.LinesFacet(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*Lines, [in] VARIANT MaskSize, [in] VARIANT Low, [in] VARIANT High, [in] VARIANT LightDark)

IHXLDContX* HImageX.LinesFacet(
[in] Hlong MaskSize, [in] VARIANT Low, [in] VARIANT High, [in] BSTR LightDark)

static void HOperatorSet.LinesFacet(HObject image, out HObject lines, HTuple maskSize, HTuple low, HTuple high, HTuple lightDark)

HXLDCont HImage.LinesFacet(int maskSize, HTuple low, HTuple high, string lightDark)

HXLDCont HImage.LinesFacet(int maskSize, double low, double high, string lightDark)

Description

The operator lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet can be used to extract lines (curvilinear structures) from the image ImageImageImageImageImageimage. The extracted lines are returned in LinesLinesLinesLinesLineslines as subpixel precise XLD-contours. The parameter LightDarkLightDarkLightDarkLightDarkLightDarklightDark determines, whether bright or dark lines are extracted.

The extraction is done by using the facet model, i.e., a least squares fit, to determine the parameters of a quadratic polynomial in x and y for each point of the image. The parameter MaskSizeMaskSizeMaskSizeMaskSizeMaskSizemaskSize determines the size of the window used for the least squares fit. Larger values of MaskSizeMaskSizeMaskSizeMaskSizeMaskSizemaskSize lead to a larger smoothing of the image, but can lead to worse localization of the line. The parameters of the polynomial are used to calculate the line direction for each pixel. Pixels which exhibit a local maximum in the second directional derivative perpendicular to the line direction are marked as line points. The line points found in this manner are then linked to contours. This is done by immediately accepting line points that have a second derivative larger than HighHighHighHighHighhigh. Points that have a second derivative smaller than LowLowLowLowLowlow are rejected. All other line points are accepted if they are connected to accepted points by a connected path. This is similar to a hysteresis threshold operation with infinite path length (see hysteresis_thresholdhysteresis_thresholdHysteresisThresholdhysteresis_thresholdHysteresisThresholdHysteresisThreshold). However, this function is not used internally since it does not allow the extraction of subpixel precise contours.

The gist of how to select the thresholds in the description of lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss also holds for this operator. A value of Sigma = 1.5 there roughly corresponds to a MaskSizeMaskSizeMaskSizeMaskSizeMaskSizemaskSize of 5 here.

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

lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet defines the following attributes for each line point:

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

The angle of the direction perpendicular to the line

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

The magnitude of the second derivative

These attributes can be queried via the operator get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldget_contour_attrib_xldGetContourAttribXldGetContourAttribXld.

Attention

The smaller the filter size MaskSizeMaskSizeMaskSizeMaskSizeMaskSizemaskSize is chosen, the more short, fragmented lines will be extracted. This can lead to considerably longer execution times.

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)  singlechannelimage objectHImageHImageHImageHImageXHobject (byte / int1 / int2 / uint2 / int4 / real)

Input image.

LinesLinesLinesLinesLineslines (output_object)  xld_cont-array objectHXLDContHXLDContHXLDContArrayHXLDContXHobject *

Extracted lines.

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

Size of the facet model mask.

Default value: 5

List of values: 3, 5, 7, 9, 11

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 ≤ 20

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 ≤ 35

Recommended increment: 0.5

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

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

Extract bright or dark lines.

Default value: 'light' "light" "light" "light" "light" "light"

List of values: 'dark'"dark""dark""dark""dark""dark", 'light'"light""light""light""light""light"

Example (HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_facet(Image,Lines,5,3,8,'light')
dev_display(Lines)

Example (C)

/* Detection of lines in an aerial image */
read_image(&Image,"mreut4_3");
lines_facet(Image:&Lines:5,3,8,"light");
disp_xld(Lines,WindowHandle);

Example (HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_facet(Image,Lines,5,3,8,'light')
dev_display(Lines)

Example (C++ (HALCON 5.0-10.0))

/* Detection of lines in an aerial image */
HWindow w(0,0,520,560);
HImage Image("mreut4_3");
HXLDContArray Lines = Image.LinesFacet(5,3,8,"light");
Lines.Display(w);

Example (HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_facet(Image,Lines,5,3,8,'light')
dev_display(Lines)

Example (HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_facet(Image,Lines,5,3,8,'light')
dev_display(Lines)

Complexity

Let A be the number of pixels in the domain of ImageImageImageImageImageimage. Then the runtime complexity is O(A*MaskSize).

The amount of temporary memory required is dependent on the height H of the domain of ImageImageImageImageImageimage and the width W of ImageImageImageImageImageimage. Let S = W*H, then lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet requires at least 55*S bytes of temporary memory during execution.

Result

lines_facetlines_facetLinesFacetlines_facetLinesFacetLinesFacet 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>:)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

gen_polygons_xldgen_polygons_xldGenPolygonsXldgen_polygons_xldGenPolygonsXldGenPolygonsXld

Alternatives

lines_gausslines_gaussLinesGausslines_gaussLinesGaussLinesGauss

See also

bandpass_imagebandpass_imageBandpassImagebandpass_imageBandpassImageBandpassImage, dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold, topographic_sketchtopographic_sketchTopographicSketchtopographic_sketchTopographicSketchTopographicSketch

References

A. Busch: “Fast Recognition of Lines in Digital Images Without User-Supplied Parameters”. In H. Ebner, C. Heipke, K.Eder, eds., “Spatial Information from Digital Photogrammetry and Computer Vision”, International Archives of Photogrammetry and Remote Sensing, Vol. 30, Part 3/1, pp. 91-97, 1994.

Module

2D Metrology


ClassesClassesClassesClasses | | | | Operators