Commit e5973a10 authored by Methsarani's avatar Methsarani

Merge branch 'IT18511444' of...

Merge branch 'IT18511444' of http://gitlab.sliit.lk/2021-122/secure-smart-parking-solution into IT18511444
parents 25baa6ab 6909b5e5
......@@ -4,7 +4,7 @@ from tracker import *
# Create tracker object
tracker = EuclideanDistTracker()
cap = cv2.VideoCapture("highway.mp4")
cap = cv2.VideoCapture("highway2.mp4")
# Object detection from Stable camera
object_detector = cv2.createBackgroundSubtractorMOG2(history=100, varThreshold=40)
......@@ -13,7 +13,7 @@ while True:
ret, frame = cap.read()
height, width, _ = frame.shape
# Extract Region of interest
# Extract Region of interest.
roi = frame[340: 720,500: 800]
# 1. Object Detection
......@@ -22,7 +22,7 @@ while True:
contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
detections = []
for cnt in contours:
# Calculate area and remove small elements
# Calculate area and remove small elements.
area = cv2.contourArea(cnt)
if area > 100:
#cv2.drawContours(roi, [cnt], -1, (0, 255, 0), 2)
......@@ -31,7 +31,7 @@ while True:
detections.append([x, y, w, h])
# 2. Object Tracking
# 2. Object Tracking.
boxes_ids = tracker.update(detections)
for box_id in boxes_ids:
x, y, w, h, id = box_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment