lines_gausslines_gaussLinesGaussLinesGausslines_gauss (算子)

名称

lines_gausslines_gaussLinesGaussLinesGausslines_gauss — 检测线及其宽度。

签名

lines_gauss(Image : Lines : Sigma, Low, High, LightDark, ExtractWidth, LineModel, CompleteJunctions : )

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

Herror T_lines_gauss(const Hobject Image, Hobject* Lines, const Htuple Sigma, const Htuple Low, const Htuple High, const Htuple LightDark, const Htuple ExtractWidth, const Htuple LineModel, const Htuple CompleteJunctions)

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

HXLDCont HImage::LinesGauss(const HTuple& Sigma, const HTuple& Low, const HTuple& High, const HString& LightDark, const HString& ExtractWidth, const HString& LineModel, const HString& CompleteJunctions) const

HXLDCont HImage::LinesGauss(double Sigma, double Low, double High, const HString& LightDark, const HString& ExtractWidth, const HString& LineModel, const HString& CompleteJunctions) const

HXLDCont HImage::LinesGauss(double Sigma, double Low, double High, const char* LightDark, const char* ExtractWidth, const char* LineModel, const char* CompleteJunctions) const

HXLDCont HImage::LinesGauss(double Sigma, double Low, double High, const wchar_t* LightDark, const wchar_t* ExtractWidth, const wchar_t* LineModel, const wchar_t* CompleteJunctions) const   ( Windows only)

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

HXLDCont HImage.LinesGauss(HTuple sigma, HTuple low, HTuple high, string lightDark, string extractWidth, string lineModel, string completeJunctions)

HXLDCont HImage.LinesGauss(double sigma, double low, double high, string lightDark, string extractWidth, string lineModel, string completeJunctions)

def lines_gauss(image: HObject, sigma: Union[float, int], low: Union[float, int], high: Union[float, int], light_dark: str, extract_width: str, line_model: str, complete_junctions: str) -> HObject

描述

算子 lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss 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 LightDarkLightDarkLightDarkLightDarklightDarklight_dark determines, whether bright or dark lines are extracted. If ExtractWidthExtractWidthExtractWidthExtractWidthextractWidthextract_width is set to 'true'"true""true""true""true""true" the line width is extracted for each line point. If LineModelLineModelLineModelLineModellineModelline_model is set to a value different from 'none'"none""none""none""none""none", lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss compensates the effect of asymmetrical lines (lines having different contrast on each side of the line), and corrects the position and width of the line. The line model used for the correction can be selected with LineModelLineModelLineModelLineModellineModelline_model as bar-shaped lines (LineModelLineModelLineModelLineModellineModelline_model = 'bar-shaped'"bar-shaped""bar-shaped""bar-shaped""bar-shaped""bar-shaped"), parabolic lines (LineModelLineModelLineModelLineModellineModelline_model = 'parabolic'"parabolic""parabolic""parabolic""parabolic""parabolic"), and Gaussian lines (LineModelLineModelLineModelLineModellineModelline_model = 'gaussian'"gaussian""gaussian""gaussian""gaussian""gaussian"). Bar-shaped lines are the right choice for most applications. If backlit tubular objects (e.g., blood vessels in X-ray images) should be extracted, the other two modes can be used. The parabolic line model should be used in applications where the lines appear very sharp. The Gaussian line model should be used in applications where the lines appear less sharp. The parameter LineModelLineModelLineModelLineModellineModelline_model is only meaningful if ExtractWidthExtractWidthExtractWidthExtractWidthextractWidthextract_width='true'"true""true""true""true""true". Because the line extractor is unable to extract certain junctions because of differential geometric reasons, it tries to extract these by different means if CompleteJunctionsCompleteJunctionsCompleteJunctionsCompleteJunctionscompleteJunctionscomplete_junctions is set to 'true'"true""true""true""true""true".

The extraction is done by using partial derivatives of a Gaussian smoothing kernel to determine the parameters of a quadratic polynomial in x and y for each point of the image. The parameter SigmaSigmaSigmaSigmasigmasigma determines the amount of smoothing to be performed. Larger values of SigmaSigmaSigmaSigmasigmasigma lead to a larger smoothing of the image, but can lead to worse localization of the line. Generally, the localization will be much better than that of lines returned by lines_facetlines_facetLinesFacetLinesFacetLinesFacetlines_facet with comparable parameters. 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_thresholdHysteresisThresholdHysteresisThresholdHysteresisThresholdhysteresis_threshold). However, this function is not used internally since it does not allow the extraction of subpixel precise contours.

For the choice of the thresholds HighHighHighHighhighhigh and LowLowLowLowlowlow one has to keep in mind that the second directional derivative depends on the amplitude and width of the line as well as the choice of SigmaSigmaSigmaSigmasigmasigma. The value of the second 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 approximately inverse exponential 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 have to be chosen. Two examples help to illustrate this: If 5 pixel wide lines with an amplitude larger than 100 are to be extracted from an image with a smoothing of SigmaSigmaSigmaSigmasigmasigma = 1.5, HighHighHighHighhighhigh should be chosen larger than 14. If, on the other hand, 10 pixel wide lines with an amplitude larger than 100 and a SigmaSigmaSigmaSigmasigmasigma = 3 are to be detected, HighHighHighHighhighhigh should be chosen larger than 3.5. For the choice of LowLowLowLowlowlow values between 0.25 HighHighHighHighhighhigh and 0.5 HighHighHighHighhighhigh are appropriate.

The parameters LowLowLowLowlowlow and HighHighHighHighhighhigh can be calculated from the respective gray value contrast of the lines to be extracted (ContrastLow and ContrastHigh) and from the chosen value for SigmaSigmaSigmaSigmasigmasigma with the following formula:

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

lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss defines the following attributes for each line point if ExtractWidthExtractWidthExtractWidthExtractWidthextractWidthextract_width was set to 'false'"false""false""false""false""false"

'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

If ExtractWidthExtractWidthExtractWidthExtractWidthextractWidthextract_width was set to 'true'"true""true""true""true""true", the following attributes are defined in addition to 'angle'"angle""angle""angle""angle""angle" and 'response'"response""response""response""response""response"

'width_left'"width_left""width_left""width_left""width_left""width_left"

The line width to the left of the line

'width_right'"width_right""width_right""width_right""width_right""width_right"

The line width to the right of the line

If ExtractWidthExtractWidthExtractWidthExtractWidthextractWidthextract_width was set to 'true'"true""true""true""true""true" and LineModelLineModelLineModelLineModellineModelline_model to a value different from 'none'"none""none""none""none""none", the following attributes are defined in addition to 'angle'"angle""angle""angle""angle""angle", 'response'"response""response""response""response""response", 'width_left'"width_left""width_left""width_left""width_left""width_left", and 'width_right'"width_right""width_right""width_right""width_right""width_right"

'asymmetry'"asymmetry""asymmetry""asymmetry""asymmetry""asymmetry"

The asymmetry of the line point

'contrast'"contrast""contrast""contrast""contrast""contrast"

The contrast of the line point

Here, the asymmetry is positive if the asymmetric part, i.e., the part with the weaker gradient, is on the right side of the line, while it is negative if the asymmetric part is on the left side of the line.

The contrast results from the difference between the gray value of the line and the gray value of the background. The contrast is positive if bright lines are extracted, while it is negative if dark lines are extracted. The returned contrast may be larger than the maximum gray value the input image type is able to represent, especially if the line model specified by LineModelLineModelLineModelLineModellineModelline_model is not present in the image. For example, for byte images, the contrast may be greater than 255.

Use get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXldget_contour_attrib_xld to obtain attribute values. See the operator reference of get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXldget_contour_attrib_xld for further information about contour attributes.

lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss 可在 OpenCL 设备上执行。

注意

In general, but in particular if the line width is to be extracted, should be selected, where w is the width (half the diameter) of the lines in the image. As the lowest allowable value must be selected. If, for example, lines with a width of 4 pixels (diameter 8 pixels) are to be extracted, should be selected. Note that the attributes 'width_left'"width_left""width_left""width_left""width_left""width_left", 'width_right'"width_right""width_right""width_right""width_right""width_right", 'asymmetry'"asymmetry""asymmetry""asymmetry""asymmetry""asymmetry", and 'contrast'"contrast""contrast""contrast""contrast""contrast" are set to zero if SigmaSigmaSigmaSigmasigmasigma is set too low.

lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss uses a special implementation that is optimized using SSE2 instructions if the system parameter 'sse2_enable'"sse2_enable""sse2_enable""sse2_enable""sse2_enable""sse2_enable" is set to 'true'"true""true""true""true""true" (which is default if SSE2 is available on your machine). This implementation is slightly inaccurate compared to the pure C version due to numerical issues. If you prefer accuracy over performance you can set 'sse2_enable'"sse2_enable""sse2_enable""sse2_enable""sse2_enable""sse2_enable" to 'false'"false""false""false""false""false" (using set_systemset_systemSetSystemSetSystemSetSystemset_system) before you call lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss. This way lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss does not use SSE2 accelerations. Don't forget to set 'sse2_enable'"sse2_enable""sse2_enable""sse2_enable""sse2_enable""sse2_enable" back to 'true'"true""true""true""true""true" afterwards.

When lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss is run on OpenCL devices, the same limitations apply as for derivate_gaussderivate_gaussDerivateGaussDerivateGaussDerivateGaussderivate_gauss: SigmaSigmaSigmaSigmasigmasigma must be chosen so that the required filter mask is smaller than 129 pixels. Also note that the results can vary compared to the CPU implementation.

请注意,若使用域缩减后的图像作为输入,滤波器算子可能会返回意外结果。请参阅 滤波器 一章

执行信息

此算子支持取消超时和中断。

参数

ImageImageImageImageimageimage (输入对象)  singlechannelimage objectHImageHObjectHImageHobject (byte / int1 / int2 / uint2 / int4 / real)

输入图像。

LinesLinesLinesLineslineslines (输出对象)  xld_cont-array objectHXLDContHObjectHXLDContHobject *

Extracted lines.

SigmaSigmaSigmaSigmasigmasigma (输入控制)  number HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Amount of Gaussian smoothing to be applied.

默认值: 1.5

建议值: 1, 1.2, 1.5, 1.8, 2, 2.5, 3, 4, 5

值范围: 0 ≤ Sigma Sigma Sigma Sigma sigma sigma

建议增量: 0.1

LowLowLowLowlowlow (输入控制)  number HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Lower threshold for the hysteresis threshold operation.

默认值: 3

建议值: 0, 0.5, 1, 2, 3, 4, 5, 8, 10

值范围: 0 ≤ Low Low Low Low low low

建议增量: 0.5

HighHighHighHighhighhigh (输入控制)  number HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Upper threshold for the hysteresis threshold operation.

默认值: 8

建议值: 0, 0.5, 1, 2, 3, 4, 5, 8, 10, 12, 15, 18, 20, 25

值范围: 0 ≤ High High High High high high

建议增量: 0.5

限制: High >= Low

LightDarkLightDarkLightDarkLightDarklightDarklight_dark (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Extract bright or dark lines.

默认值: 'light' "light" "light" "light" "light" "light"

值列表: 'dark'"dark""dark""dark""dark""dark", 'light'"light""light""light""light""light"

ExtractWidthExtractWidthExtractWidthExtractWidthextractWidthextract_width (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Should the line width be extracted?

默认值: 'true' "true" "true" "true" "true" "true"

值列表: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"

LineModelLineModelLineModelLineModellineModelline_model (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Line model used to correct the line position and width.

默认值: 'bar-shaped' "bar-shaped" "bar-shaped" "bar-shaped" "bar-shaped" "bar-shaped"

值列表: 'bar-shaped'"bar-shaped""bar-shaped""bar-shaped""bar-shaped""bar-shaped", 'gaussian'"gaussian""gaussian""gaussian""gaussian""gaussian", 'none'"none""none""none""none""none", 'parabolic'"parabolic""parabolic""parabolic""parabolic""parabolic"

CompleteJunctionsCompleteJunctionsCompleteJunctionsCompleteJunctionscompleteJunctionscomplete_junctions (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Should junctions be added where they cannot be extracted?

默认值: 'true' "true" "true" "true" "true" "true"

值列表: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"

示例(HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_gauss(Image,Lines,1.5,3,8,'light','true','bar-shaped','true')
dev_display(Lines)

示例(C)

/* Detection of lines in an aerial image */
read_image(&Image,"mreut4_3");
lines_gauss(Image:&Lines:1.5,3,8,"light","true","bar-shaped","true");
disp_xld(Lines,WindowHandle);

示例(HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_gauss(Image,Lines,1.5,3,8,'light','true','bar-shaped','true')
dev_display(Lines)

示例(HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_gauss(Image,Lines,1.5,3,8,'light','true','bar-shaped','true')
dev_display(Lines)

示例(HDevelop)

* Detection of lines in an aerial image
read_image(Image,'mreut4_3')
lines_gauss(Image,Lines,1.5,3,8,'light','true','bar-shaped','true')
dev_display(Lines)

复杂度

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

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_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss requires at least 55*S bytes of temporary memory during execution.

结果

lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss 在所有参数正确且执行过程中未发生错误时返回 2 ( H_MSG_TRUE )。如果输入为空则可设置行为通过 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>)。如有必要,则抛出异常。

可能的后继

gen_polygons_xldgen_polygons_xldGenPolygonsXldGenPolygonsXldGenPolygonsXldgen_polygons_xld

替代

lines_facetlines_facetLinesFacetLinesFacetLinesFacetlines_facet

另见

bandpass_imagebandpass_imageBandpassImageBandpassImageBandpassImagebandpass_image, dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold, topographic_sketchtopographic_sketchTopographicSketchTopographicSketchTopographicSketchtopographic_sketch

参考文献

C. Steger: “Extracting Curvilinear Structures: A Differential Geometric Approach”. In B. Buxton, R. Cipolla, eds., “Fourth European Conference on Computer Vision”, Lecture Notes in Computer Science, Volume 1064, Springer Verlag, pp. 630-641, 1996.
C. Steger: “Extraction of Curved Lines from Images”. In “13th International Conference on Pattern Recognition”, Volume II, pp. 251-255, 1996.
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 lines with parabolic and Gaussian profiles”. Computer Vision and Image Understanding, vol. 117, no. 2, pp. 97-112, 2013.

模块

二维计量