Main Content

segmentLaneMarkerRidge

Detect lanes in a grayscale intensity image

Description

example

birdsEyeBW = segmentLaneMarkerRidge(birdsEyeImage,birdsEyeConfig,approxMarkerWidth) returns a binary image that represents lane features. The function segments the input grayscale intensity image, birdsEyeImage, using a lane ridge detector. birdsEyeConfig transforms point locations from vehicle coordinates to image coordinates. The approxMarkerWidth argument is in world units, and specifies the approximate width of the lane-like features that are detected.

birdsEyeBW = segmentLaneMarkerRidge(___,Name,Value) returns a binary image with additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Load a bird's-eye-view configuration object.

load birdsEyeConfig

Load the image captured from the sensor that is defined in the bird's-eye-view configuration object.

I = imread('road.png');
figure
imshow(I)
title('Original Image')

Create a bird's-eye-view image.

birdsEyeImage = transformImage(birdsEyeConfig,I);
imshow(birdsEyeImage)

Convert bird's-eye-view image to grayscale.

birdsEyeImage = im2gray(birdsEyeImage);

Set the approximate lane marker width to 25 cm, which is in world units.

approxMarkerWidth = 0.25;

Detect lane features.

birdsEyeBW = segmentLaneMarkerRidge(birdsEyeImage,birdsEyeConfig,approxMarkerWidth);
imshow(birdsEyeBW)

Input Arguments

collapse all

Bird’s-eye-view image, specified as a nonsparse matrix.

Data Types: single | int16 | uint16 | uint8

Object to transform point locations from vehicle to image coordinates, specified as a birdsEyeView object.

Approximate width of lane-like features for the function to detect in the bird’s-eye-view image, specified as a real scalar in world units, such as meters.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'ROI' []

Region of interest in world units, specified as the comma-separated pair consisting of 'ROI' and a 1-by-4 vector in the format [xmin,xmax,ymin,ymax]. The function searches for lane-like features only within this region of interest. If you do not specify ROI, the function searches the entire image.

Sensitivity factor, specified as the comma-separated pair consisting of 'Sensitivity' and a real scalar in the range [0, 1]. You can increase this value to detect more lane-like features. However, the higher sensitivity can increase the risk of false detections.

Output Arguments

collapse all

Bird’s-eye-view image, returned as a binary image that represents lane features.

More About

collapse all

Vehicle Coordinate System

This function uses a vehicle coordinate system to define point locations, as defined by the sensor in the birdsEyeView object. It uses the same world units as defined by the birdsEyeConfig.Sensor.WorldUnits property. See Coordinate Systems in Automated Driving Toolbox.

Algorithms

segmentLaneMarkerRidge selects lanes by searching for pixels that are lane-like. Lane-like pixels are groups of pixels with high-intensity contrast compared to neighboring pixels on either side. The function chooses the filter used to threshold the intensity contrast based on the approxMarkerWidth value. The filter has high responses for pixels with intensity values higher than those of the left and right neighboring pixels that have a similar intensity at a distance of approxMarkerWidth. The function retains only certain values from the filtered image based on the Sensitivity factor.

References

[1] Nieto, M., J. A. Laborda, and L. Salgado. “Road Environment Modeling Using Robust Perspective Analysis and Recursive Bayesian Segmentation.” Machine Vision and Applications. Volume 22, Issue 6, 2011, pp. 927–945.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2017a

See Also