Main Content

laneBoundaryDetector

Detector for lane boundaries in images

Since R2023a

Description

The laneBoundaryDetector object detects lane boundaries in images by using a pretrained Cross Layer Refinement Network (CLRNet) lane detection model [1].

Note

This object requires an internet connection to download the CLRNet lane detection model for its first use.

Creation

Description

example

detector = laneBoundaryDetector creates a default laneBoundaryDetector object detector to detect lane boundaries in images.

detector = laneBoundaryDetector(Name=Value) sets properties using one or more name-value arguments.

Note

This object requires the Scenario Builder for Automated Driving Toolbox™ support package, Deep Learning Toolbox™, and the Deep Learning Toolbox Converter for ONNX™ Model Format support package. You can install the Scenario Builder for Automated Driving Toolbox and Deep Learning Toolbox Converter for ONNX Model Format support packages from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Properties

expand all

This property is read-only.

Name of the lane detection model, specified as a string scalar or character vector. By default, the object uses the pretrained CLRNet model downloaded when you first create the object. For more information, see CLRNet.

To set this property, specify it at object creation. To use a custom CLRNet detector, you must specify the path to a MAT file of a valid model. Currently, this function supports only CLRNet lane detection models.

This property is read-only.

Path on which to store the lane detection model, specified as a string scalar or character vector. By default, the laneBoundaryDetector object downloads the CLRNet lane detection model from the internet and stores it in the current working directory. To set this property, specify it at object creation.

Object Functions

detectDetect lane boundaries in images

Examples

collapse all

Detect lane boundary points in an RGB image by using the laneBoundaryDetector object.

Read an image into the workspace.

I = imread("highway.png");

Initialize the laneBoundaryDetector object.

detector = laneBoundaryDetector;

Detect the boundary points of the lanes in the image by using the detect object function of the laneBoundaryDetector object.

lanes = detect(detector,I,ROI=120,ExecutionEnvironment="cpu");

Insert the detected lane boundary points into the image, as markers, by using the insertMarker function.

for i = 1:size(lanes{1},2)
    if ~isempty(lanes{1}{i})
        I = insertMarker(I,lanes{1}{1,i},"o",Size=3);
    end
end

Display the image, annotated with the detected lane boundary points.

imshow(I)

More About

expand all

References

[1] Zheng, Tu, Yifei Huang, Yang Liu, Wenjian Tang, Zheng Yang, Deng Cai, and Xiaofei He. “CLRNet: Cross Layer Refinement Network for Lane Detection.” In 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 888–97. New Orleans, LA, USA: IEEE, 2022. https://doi.org/10.1109/CVPR52688.2022.00097.

Version History

Introduced in R2023a