python对视频画框标记后保存的方法


Posted in Python onDecember 07, 2018

需要画框取消注释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对视频画框标记后保存的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

Python 相关文章推荐
Python写的Discuz7.2版faq.php注入漏洞工具
Aug 06 Python
Python中的作用域规则详解
Jan 30 Python
Python虚拟环境Virtualenv使用教程
May 18 Python
Python实现冒泡排序的简单应用示例
Dec 11 Python
利用python解决mysql视图导入导出依赖的问题
Dec 17 Python
django用户注册、登录、注销和用户扩展的示例
Mar 19 Python
python中ImageTk.PhotoImage()不显示图片却不报错问题解决
Dec 06 Python
Python 3 实现定义跨模块的全局变量和使用教程
Jul 07 Python
Python 批量刷博客园访问量脚本过程解析
Aug 30 Python
在 Linux/Mac 下为Python函数添加超时时间的方法
Feb 20 Python
python openCV实现摄像头获取人脸图片
Aug 20 Python
Python学习之迭代器详解
Apr 01 Python
python opencv读mp4视频的实例
Dec 07 #Python
python利用requests库模拟post请求时json的使用教程
Dec 07 #Python
Python 加密与解密小结
Dec 06 #Python
Python 带有参数的装饰器实例代码详解
Dec 06 #Python
DES加密解密算法之python实现版(图文并茂)
Dec 06 #Python
python获取时间及时间格式转换问题实例代码详解
Dec 06 #Python
python中ImageTk.PhotoImage()不显示图片却不报错问题解决
Dec 06 #Python
You might like
php5 pdo新改动加载注意事项
2008/09/11 PHP
php实现Session存储到Redis
2015/11/11 PHP
php数据库操作model类(使用__call方法)
2016/11/16 PHP
TP3.2.3框架使用CKeditor编辑器在页面中上传图片的方法分析
2019/12/31 PHP
JavaScript 核心参考教程 内置对象
2009/10/13 Javascript
Jquery Ajax学习实例5 向WebService发出请求,返回泛型集合数据的异步调用
2010/03/17 Javascript
jQuery 翻牌或百叶窗效果(内容三秒自动切换)
2012/06/14 Javascript
jquery插件制作 提示框插件实现代码
2012/08/17 Javascript
jQuery插件的写法分享
2013/06/12 Javascript
使用JQUERY进行后台页面布局控制DIV实现左右式
2014/01/07 Javascript
js实现checkbox全选和反选示例
2014/05/01 Javascript
js兼容pc端浏览器并有多种弹出小提示的手机端浮层控件实例
2015/04/29 Javascript
Jquery promise实现一张一张加载图片
2015/11/13 Javascript
jquery判断密码强度的验证代码
2020/04/22 Javascript
jQuery实现的背景颜色渐变动画效果示例
2017/03/24 jQuery
js实现抽奖效果
2017/03/27 Javascript
JS自定义函数实现时间戳转换成date的方法示例
2017/08/27 Javascript
node.js实现微信JS-API封装接口的示例代码
2017/09/06 Javascript
webpack分离css单独打包的方法
2018/06/12 Javascript
Vue Router的懒加载路径的解决方法
2018/06/21 Javascript
JQuery获取元素尺寸、位置及页面滚动事件应用示例
2019/05/14 jQuery
vue实现移动端拖动排序
2020/08/21 Javascript
[01:53]2016完美“圣”典风云人物:Maybe专访
2016/12/05 DOTA
[03:23:49]2016.12.17日完美“圣”典全回顾
2016/12/19 DOTA
python 字符串只保留汉字的方法
2018/11/16 Python
python模糊图片过滤的方法
2018/12/14 Python
Python中三元表达式的几种写法介绍
2019/03/04 Python
浅谈Python中eval的强大与危害
2019/03/13 Python
django-rest-framework解析请求参数过程详解
2019/07/18 Python
在django中实现页面倒数几秒后自动跳转的例子
2019/08/16 Python
Html5+CSS3+EL表达式问题小结
2020/12/19 HTML / CSS
JDK安装目录下有哪些内容
2014/08/25 面试题
教师实习自我鉴定
2013/12/14 职场文书
远程研修随笔感言
2014/02/10 职场文书
小学生暑假生活总结
2015/07/13 职场文书
python套接字socket通信
2022/04/01 Python