VEHICLE DETECTION USING PYTHON AND OPENCV
The objective of the program given is to detect object of interest(Car) in video frames and to keep tracking the same object. This is a project of how to detect vehicles in Python.
Why Vehicle Detection?
- The startling losses both in human lives and finance caused by vehicle accidents.
- Detecting vehicles in images acquired from a moving platform is a challenging problem.
Video detection combines real-time image processing and computerized pattern recognition in a flexible platform; it uses a vision processor to analyze real-time changes in the image. In this system, cameras called image sensors capture images and provide a video signal to the vision processor. The video signal is analyzed and the results are recorded.
**** CODE *****
import cv2
import numpy as np
import time
import vehicles
cap=cv2.VideoCapture(“video 1.mp4”)
fgbg=cv2.createBackgroundSubtractorMOG2(detectShadows=False,history=200,varThreshold = 90)
kernalOp = np.ones((3,3),np.uint8)
kernalOp2 = np.ones((5,5),np.uint8)
kernalCl = np.ones((11,11),np.uint8)
font = cv2.FONT_HERSHEY_SIMPLEX
cars = []
max_p_age = 5
pid = 1
cnt_up=0
cnt_down=0
line_up=400
line_down=250
up_limit=230
down_limit=int(4.5*(500/5))
The above picture shows you the results of the video in a screenshot