肇东新闻,难兄难弟之神探李奇,虹吸战士黑镜
需要画框取消注释rectangle
import cv2 import os,sys,shutil import numpy as np # open the input movie file, input the filepath as input_filepath = sys.argv[1] input_movie = cv2.videocapture(input_filepath) length = int(input_movie.get(cv2.cap_prop_frame_count)) #设置output output_movie = cv2.videowriter(input_filepath.replace("mp4","avi").replace("input","output"), cv2.videowriter_fourcc('d', 'i', 'v', 'x'), 25, (1280, 720)) # initialize some variables frame_number = 0 while true: # grab a single frame of video ret, frame = input_movie.read() frame_number += 1 # quit when the input video file ends if not ret: break # draw a box around the body: input the top left point(x,y) and bottom right point(x,y) #cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2) # write the resulting image to the output video file print("writing frame {} / {}".format(frame_number, length)) output_movie.write(frame) # all done! input_movie.release() cv2.destroyallwindows()
以上这篇python对视频画框标记后保存的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新手学习Python2和Python3中print不同的用法
Python基于os.environ从windows获取环境变量
网友评论