停车位即时检测:Python实现版本

停车位即使检测

源代码

# -*- coding: utf-8 -*-

import yaml
import numpy as np
import cv2

#fn = r"../datasets/1.mpg"
fn = r"../datasets/1.mp4" #parkinglot_1_480p
# fn_yaml = r"../datasets/CUHKSquare.yml"
fn_yaml = r"../datasets/parking2.yml"
fn_out = r"../datasets/output.avi"
config = {'save_video': True,
          'text_overlay': True,
          'parking_overlay': True,
          'parking_id_overlay': False,
          'parking_detection': True,
          'min_area_motion_contour': 60,
          'park_sec_to_wait': 3,
          'start_frame': 0} #35000

# Set capture device or file
cap = cv2.VideoCapture(fn)
# print cap.get(5) 
video_info = {'fps':    cap.get(cv2.CAP_PROP_FPS),
        



# Read YAML data (parking space polygons)
with open(fn_yaml, 'r') as stream:
    parking_data = yaml.load(stream)
parking_contours = []
parking_bounding_rects = []
parking_mask = []
for park in parking_data:
    points = np.array(park['points'])
    re

你可能感兴趣的:(机器学习原理讲解与代码实现,AI原理与概念,机器学习,深度学习实战讲解与分析)