Detect and Fit Line
Basic Concepts
-
Caliper
In image processing, a virtual measurement tool detects edges within a specified region. Adjusting its count, width, and length affects the accuracy and stability of edge detection.
-
Edge polarity
It refers to the direction of grayscale change across an edge, e.g., dark-to-light or light-to-dark.
Input and Output
Input
| Input ports | Data type | Description |
|---|---|---|
Image |
Image |
The image used for detecting a straight edge. |
Alignment Parameter Group |
Pose2D |
Used to adjust the target region’s pose in sync with the target object’s pose changes. |
Output
| Output Port | Data Type | Description |
|---|---|---|
Fitted Line |
Shape2D/Line |
The line obtained by fitting. |
Midpoint |
Shape2D/Point |
The midpoint of the fitted line. |
Midpoint X |
Number |
The X coordinate of the midpoint of the fitted line. |
Midpoint Y |
Number |
The Y coordinate of the midpoint of the fitted line. |
Rotation Angle |
Number |
The rotation angle of the fitted line relative to the positive X-axis. |
Parameter Description
| Parameter | Description |
|---|---|
ROI Settings |
You can draw a rectangular ROI. The system extracts multiple columns of pixels according to the caliper settings, and the detected edge points in each column will be used for line fitting. In the data visualization window, the arrow on each caliper indicates the direction in which the caliper detects edges. The Step detects edge points along the caliper’s direction. For stable edge detection, this direction should be as perpendicular as possible to the line edge. If the line to be detected is tilted, you can adjust the rotation angle of the rectangular ROI so that the caliper and its detection direction rotate along with the ROI, allowing them to align with the line’s orientation. |
Fitted Line Direction |
Select an appropriate option from the drop-down list to determine the direction vector of the fitted line, thus determining the direction of the fitted line.
|
Edge Polarity |
This parameter specifies the direction in which the grayscale values change at the edges. Value list:
|
Filter Window Size |
Specify the window size to be used when filtering each column of pixels in its direction. Filtering can reduce noise and improve the stability of edge detection results. |
Edge Type |
Define the edge types to be retained in edge detection. Value list: Best, First, Last. |
Gray Value Change Threshold |
This parameter specifies the minimum gray value change between adjacent pixels at the edge of an extracted pixel column required for edge point detection. Setting this parameter value properly can effectively filter out weak edges and noise. |
Use Relative Threshold |
Once selected, an edge point is detected only if the gray value change between adjacent pixels at the edge of a pixel column meets or exceeds the specified percentage of the maximum change in that column. Once this parameter is selected, set Relative Threshold. |
Outlier Fraction |
The percentage of outlier points to be removed during line fitting. |