vipldws
Open this model

# Lane Departure Warning System

This demo detects and tracks road lane markers in a video sequence and notifies the driver if they are moving across a lane. The demo illustrates how to use the Hough Transform, Hough Lines and Kalman Filter blocks to create a line detection and tracking algorithm. The demo implements this algorithm using the following steps: 1) Detect lane markers in the current video frame. 2) Match the current lane markers with those detected in the previous video frame. 3) Find the left and right lane markers. 4) Issue a warning message if the vehicle moves across either of the lane markers.

To process low quality video sequences, where lane markers might be difficult to see or are hidden behind objects, the demo waits for a lane marker to appear in multiple frames before it considers the marker to be valid. The demo uses the same process to decide when to begin to ignore a lane marker.

Note: The demo parameters are defined in the model workspace. To access the parameters, click View > Model Explorer. Then navigate to Model Workspace under model's name.

Watch the Lane Departure Warning System demo.

## Contents

- Demo Model
- Lane Detection Subsystem
- Lane Tracking Subsystem
- Departure Warning Subsystem
- Lane Departure Warning System Results
- Available Demo Versions

## Demo Model

The following figure shows the Lane Departure Warning System demo model:

## Lane Detection Subsystem

This subsystem uses the 2-D FIR Filter and Autothreshold blocks to detect the left boundaries of the lane markers in the current video frame. The boundaries of the lane markers resemble straight lines and correspond to peak values in the Hough transform matrix. This subsystem uses the Find Local Maxima block to determine the Polar coordinate location of the lane markers.

## Lane Tracking Subsystem

The demo saves the previously-detected lanes in a repository and counts the number of times each lane is detected. This subsystem matches the lanes found in the current video frame with those in the repository. If a current lane is similar enough to another lane in the repository, the demo updates the repository with the lanes' current location. The Kalman Filter block predicts the location of each lane in the repository, which improves the accuracy of the lane tracking.

## Departure Warning Subsystem

This subsystem uses the Hough Lines block to convert the Polar coordinates of a line to Cartesian coordinates. The subsystem uses these Cartesian coordinates to calculate the distance between the lane markers and the center of the video bottom boundary. If this distance is less than the threshold value, the demo issues a warning. This subsystem also determines if the line is yellow or white and whether it is solid or broken.

## Lane Departure Warning System Results

The Safety Margin Signals window shows a plot of a safety margin metric. The safety margin metric is determined by the distance between the car and the closest lane marker. When the safety margin metric, shown in yellow, drops below 0, shown in magenta, the car is in lane departure mode otherwise the car is in normal driving mode.

The Results window shows the left and right lane markers and a warning message. The warning message indicates that the vehicle is moving across the right lane marker. The type and color of the lane markers are also shown in this window. In addition to the text message, the Windows® version of the demo issues an audio warning.

## Available Demo Versions

Floating-point versions of this demo:

Windows only: vipldws_win.mdl

Platform independent: vipldws_all.mdl

Fixed-point versions of this demo:

Windows only: vipldws_fixpt_win.mdl

Platform independent: vipldws_fixpt_all.mdl

Windows-only demo models might contain compressed multimedia files or To Video Display blocks, both of which are only supported on Windows platforms. The To Video Display block supports code generation, and its performance is optimized for Windows.