Need help with vehicle_detection_haarcascades?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

471 Stars 459 Forks 16 Commits 9 Opened issues


Vehicle Detection by Haar Cascades with OpenCV

Services available


Need anything else?

Contributors list

# 13,914
16 commits

Vehicle Detection with Haar Cascades

Last page update: 19/10/2016

Last version: 1.0.0 (see Release Notes for more info)

Hello everyone, An easy way to perform vehicle detection is by using Haar Cascades. Currently, I don't have a detailed tutorial about it, but you can get some extra information in the OpenCV homepage, see Cascade Classifier page. See also Cascade Classifier Training for training your own cascade classifier.

The haar-cascade cars.xml was trained using 526 images of cars from the rear (360 x 240 pixels, no scale). The images were extracted from the Car dataset proposed by Brad Philip and Paul Updike taken of the freeways of southern California.

For more information, please see:

  • Train Your Own OpenCV Haar Classifier

  • Related paper:

    • Oliveira, M.; Santos, V. Automatic Detection of Cars in Real Roads using Haar-like Features (PDF)
  • Some additional resources:


For Windows users

  • Check if your OpenCV is installed at: C:\OpenCV2.4.10
  • There is a Visual Studio 2013 template project in the vs2013/ folder. Open it in the Visual Studio IDE and select [Release]-[Win32] or [Release]-[x64] mode. Next, click on runvehicledetection.bat and enjoy!

For Linux users

  • For Linux and Mac users, a Makefile is provided to compile the source code.
  • * Requirements: OpenCV 2.4.x (it only works with this version).
  • * Check out the latest project source code and compile it:
    ~/git clone
    ~/cd vehicle_detection_haarcascades
    ~/vehicle_detection_haarcascades/ chmod +x
    ~/vehicle_detection_haarcascades/ chmod +x
    ~/vehicle_detection_haarcascades/cd build
    ~/vehicle_detection_haarcascades/build/ cmake ..
    ~/vehicle_detection_haarcascades/build/ make
  • * Run demos:

Docker image

  • Docker image is available at:
  • * Ubuntu 16.04 + VNC + OpenCV 2.4.13 + Python 2.7 + Vehicle Detection, Tracking and Counting

Release Notes: * Version 1.0.0: First version.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.