Real-Time Detection of Running Cars using Python-OpenCV

Original article was published by Aditya Bhandari on Deep Learning on Medium


Real-Time Detection of Running Cars using Python-OpenCV

What is OpenCV !!

OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code.

The library has more than 2500 optimized algorithms, which includes a comprehensive set of both classic and state-of-the-art computer vision and machine learning algorithms. These algorithms can be used to detect and recognize faces, identify objects, classify human actions in videos, track camera movements, track moving objects, extract 3D models of objects, produce 3D point clouds from stereo cameras, stitch images together to produce a high-resolution image of an entire scene, find similar images from an image database, remove red eyes from images taken using flash, follow eye movements, recognize scenery and establish markers to overlay it with augmented reality, etc.

Some Real-world Applications

  • In a self-driving car, to detect the traffic signals.
  • Multiple color detection is used in some industrial robots, to performing pick-and-place tasks in separating different colored objects.
Detecting & Tracking the object in VF.

Import Libraries

Capture Frames from a video

Trained XML Classifier

Loop

Convert to grayscale

Detects Cars of different sizes

Draw a Rectangle in each car

Display Frames

To Stop & De-allocate any associated memory usage

Note:- Put The Car.xml File in the same Folder