python对视频画框标记后保存的方法-创新互联

需要画框取消注释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对视频画框标记后保存的方法-创新互联
文章路径:http://csruizhi.cn/article/gjioc.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 成都网站建设 网站建设开发 网站建设方案 成都网站建设流程 公司网站建设 网站制作 重庆网站制作 成都网站建设公司 企业网站建设 成都网站建设 上市集团网站建设 成都网站建设 手机网站制作 自适应网站建设 移动网站建设 企业网站设计 网站设计 成都响应式网站建设 成都网站制作 营销型网站建设 高端网站设计 营销网站建设