# Lane-line Detector#

## Overview top#

The lane-line detector tool can used to prepare lane-line data for the segmentation and lane-line sensors. Depending on the desired result, it can use data from map annotations and/or road intensity maps.

If your annotation data is precise and aligns with the environment well, it's suggested to use it as the only input for this tool. On the other hand, if environment and annotations are slightly misaligned, you might want to try using the optional feature that will attempt to detect lines on intensity maps and correct the annotations based on this. Refer to the main options section for more details.

The main output from this tool is a set of meshes matching lane-lines on the road. These meshes are not visible for normal cameras, but will be used by the segmentation sensor to differentiate between road and lane-lines. If Generate Line Sensor Data in main options is enabled, output will also include correction data for the lane-line sensor. You can find more details about this on lane-line sensor page.

If line visibility for segmentation camera is unnecessary or undesired, you can safely ignore this tool. Comparison of segmentation image with and without lane-lines is shown below.

## Accessing the Detector top#

To open the lane-line detector window, open a Simulator project in Unity editor, then select Simulator/Detect Lane-lines on the menu bar.

## Main Options top#

There are two main options that must be set before any other, more detailed, settings are available.

The Line Source dropdown describes which data should be used to generate lines that will be visible by segmentation sensor. Three options are available: - HD Map - only annotation data will be used and all generated lines will follow lines from the high-definition (HD) map. - Intensity Map - only road intensity maps will be used. This method is based on image processing and results may vary depending on the quality of the intensity maps. - Corrected HD Map - annotation data will be used, but the tool will attempt to correct any misaligned lines based on road intensity maps.

The Generate Line Sensor Data checkbox determines whether the annotations should be corrected for the lane-line sensor. Correction is based on road intensity maps, similar to the Corrected HD Map option in the Line Source setting. If this option is disabled, raw annotation data will be used instead. Note that this setting is separate to Line Source, and both sensors can use differently processed data.

After generation is done, a new object named LineData_generated will be created on the scene. When it is selected, the scene view will show outlines of the generated lines. If you're not satisfied with the result, try using a different mode, or changing the advanced settings.

## Line-detection Settings top#

This section is only visible if any of the main options was configured to use line-detection based on intensity maps.

### Grouping Settings top#

Parameter Name Description
Line Distance Threshold The maximum distance between line segments that can be classified as a single lane-line when classifying lines detected on intensity maps.
Line Angle Threshold The maximum angle between line segments that can be classified as a single lane-line when classifying lines detected on intensity maps.
Max Line Segment Length The maximum length of a single detected line segment. Longer lines will be split into multiple segments.
Worst Fit Threshold The maximum valid distance between a line center and the segments creating it. This is used to filter out large clusters of spread-parallel line-segments.
Min Width Threshold The maximum distance between segments that should be considered parts of a single line. This is used to filter out large clusters of spread-parallel line-segments.
Joint Line Threshold The minimum viable width of a lane-line. This is used to filter out linear artifacts from detected line-segments.

### Postprocessing Settings top#

Parameter Name Description
World Space Snap Distance The maximum distance between detected lines that could be considered parts of a single curve. Lines below this threshold will have their ends snap together to create a better curve approximation.
World Dotted Line Distance The maximum distance between detected lines that could be considered separate parts of a single dotted line.
World Space Snap Angle The maximum angle between detected lines that could be considered parts of a single curve (solid or dotted).

## Line Mesh Generation Settings top#

This section is only visible if Line Source, in the main options, was configured to use map annotations.

Parameter Name Description
Snap Lane Ends If this option is enabled, end vertices from subsequent lanes will be snapped together, within the Snap Threshold, to remove holes.
Snap Threshold The maximum distance (in meters) within which lane ends can be snapped together. This is only available if Snap Lane Ends is enabled.
Line UV Unit The distance, in meters, defining the size of a single UV coordinates-tile for lane-lines. Increasing this value will stretch the line texture over a longer distance.
Line Width The width, in meters, of a single lane-line. Double lines will be scaled proportionally.
Line Bump The vertical distance, in meters, between road and lane-lines. This elevates lines slightly to avoid clipping.