forked from ahmetozlu/tensorflow_object_counting_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
object_tracking.py
27 lines (22 loc) · 880 Bytes
/
object_tracking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#----------------------------------------------
#--- Author : Ahmet Ozlu
#--- Mail : ahmetozlu93@gmail.com
#--- Date : 14th August 2019
#----------------------------------------------
import numpy as np
import cv2
import backbone
from utils.object_tracking_module import tracking_layer
cap = cv2.VideoCapture("./input_images_and_videos/vehicle_survaillance.mp4")
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
fps = int(cap.get(cv2.CAP_PROP_FPS))
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('the_output.avi',fourcc, fps, (width, height))
while(True):
ret, img = cap.read()
np.asarray(img)
processed_img = backbone.processor(img)
out.write(processed_img)
print("writing frame...")
print("end of the video!")