需要画框取消注释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_ _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
_number = 0
while True:
# Grab a single of video
ret, = input_movie.read()
_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( , (left, top), (right, bottom), (0, 0, 255), 2)
# Write the resulting image to the output video file
print(\"Writing {} / {}\".format( _number, length))
output_movie.write( )
# All done!
input_movie.release()
cv2.destroyAllWindows()
以上这篇python对视频画框标记后保存的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
继续阅读与本文标签相同的文章
下一篇 :
数据中心如何保护信息安全
-
阿里云创新中心蔡素卿:双创是阿里发展生态业务的有力抓手
2026-05-19栏目: 教程
-
通过命令行参数发送阿里云短信 - python
2026-05-19栏目: 教程
-
阿里IOT智能人居邢超:开放阿里生态,助力消费级物联网产业全链路升级
2026-05-19栏目: 教程
-
Cassandra监控运维介绍
2026-05-19栏目: 教程
-
C#读写Excel
2026-05-19栏目: 教程
