## Documentation Center |

This example shows how to detect and track cars in a video sequence using background estimation.

On this page… |
---|

The following figure shows the Tracking Cars Using Background Estimation model:

**Tracking Cars Using Background Estimation Results**

The model uses the background estimation technique that you specify in the Edit Parameters block to estimate the background. Here are descriptions of the available techniques:

Estimating median over time - This algorithm updates the median value of the time series data based upon the new data sample. The example increments or decrements the median by an amount that is related to the running standard deviation and the size of the time series data. The example also applies a correction to the median value if it detects a local ramp in the time series data. Overall, the estimated median is constrained within Chebyshev's bounds, which are sqrt(3/5) of the standard deviation on either side of the mean of the data.

Computing median over time - This method computes the median of the values at each pixel location over a time window of 30 frames.

Eliminating moving objects - This algorithm identifies the moving objects in the first few image frames and labels the corresponding pixels as foreground pixels. Next, the algorithm identifies the incomplete background as the pixels that do not belong to the foreground pixels. As the foreground objects move, the algorithm estimates more and more of the background pixels.

Once the example estimates the background, it subtracts the background from each video frame to produce foreground images. By thresholding and performing morphological closing on each foreground image, the model produces binary feature images. The model locates the cars in each binary feature image using the Blob Analysis block. Then it uses the Draw Shapes block to draw a green rectangle around the cars that pass beneath the white line. The counter in the upper left corner of the Results window tracks the number of cars in the region of interest.

Windows® only: viptraffic_win.mdlviptraffic_win.mdl

Platform independent: viptraffic_all.mdlviptraffic_all.mdl

Windows-only example 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.

Was this topic helpful?