This example shows how to use color information to detect and track road edges set in primarily residential settings where lane markings may not be present. The Color-based Tracking example illustrates how to use the Color Space Conversion block, the Hough Transform block, and the Kalman Filter block to detect and track information using hue and saturation.
The following figure shows the Color-based Tracking model:
The example algorithm performs a search to define the left and right edges of a road by analyzing video images for change in color behavior. First a search for edge pixels, or a line passing through enough number of color pixels, whichever comes first, is initiated from the bottom center of the image. The search moves to both the upper left and right corners of the image.
To process low quality video sequences, where road sides might be difficult to see, or are obstructed, the algorithm will wait for multiple frames of valid edge information. The example uses the same process to decide when to begin to ignore a side.
The Detection window shows the road sides detected in the current video frame.
When no road sides are visible, the Tracking window displays an error symbol.
When only one side of the road is visible, the example displays an arrow parallel to the road side. The direction of the arrow is toward the upper point of intersection between the road side and image boundary.
When both of the road sides are visible, the example shows an arrow in the center of the road in the direction calculated by averaging the directions of the left and right sides.