zoukankan      html  css  js  c++  java
  • opencv读写

    # coding:utf-8
    import cv2, os, sys
    import numpy as np

    '''
    XSQ_20190130155258_20190130174000.mp4 [[0,420],[1920,360]]
    '''
    video_name = 'XSQ_20190130155258_20190130174000.mp4'
    video_path = './XSQ/'+video_name
    save_video_path = './mask/'+video_name
    cap = cv2.VideoCapture(video_path)
    if not cap.isOpened():
    print("video not open")
    sys.exit(-1)

    fps = cap.get(cv2.CAP_PROP_FPS)
    size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),
    int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
    foucc = cap.get(cv2.CAP_PROP_FOURCC)

    writer = cv2.VideoWriter(save_video_path, cv2.VideoWriter_fourcc(*'MP4V'), fps, size)
    idx = 0
    while True:
    ret, frame = cap.read()
    if ret:
    writer.write(frame)
    # print(idx)
    # idx += 1
    else:
    break

  • 相关阅读:
    RMQ
    LCA 笔记
    LUCAS 定理
    topcoder 643 DIV2
    BZOJ 1071组队
    Codeforces Round #283 (Div. 2)
    topcoder 642
    Codeforces Round #278 (Div. 2)
    树链剖分
    Codeforces Round #277 (Div. 2)
  • 原文地址:https://www.cnblogs.com/chinesezyc/p/10374356.html
Copyright © 2011-2022 走看看