Exemplo n.º 1
0
framespost=20
fps=30

# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video", help="path to the video file")
#ap.add_argument("-a", "--min-area", type=int, default=500, help="minimum area size")
args = vars(ap.parse_args())

                   
# open the video file
cap = cv2.VideoCapture(args["video"])

# get the frame size
frameExtractor = VideoHelper()
size = frameExtractor.getFrameSize(args["video"])
xproc = size[0]  # x,y resolution for processing is taken from the video file
yproc = size[1] 
record = True  # should we record video output?
voname = 'track-out1.avi' # name of video output to save
vonamerep = 'track-out2.avi'  # color track with circle

if (record):
    fourcc_video = cv2.VideoWriter_fourcc(*'XVID')
    video = cv2.VideoWriter(voname, fourcc_video, fps, (xproc,yproc))  # open output video to record
    fourcc_videorep = cv2.VideoWriter_fourcc(*'XVID')
    videorep = cv2.VideoWriter(vonamerep, fourcc_videorep, fps, (xproc,yproc))  # open output video to record

history = 5
varThreshold = 18
detectShadows = True