python對(duì)視頻畫(huà)框標(biāo)記后保存的方法
需要畫(huà)框取消注釋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))
#設(shè)置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對(duì)視頻畫(huà)框標(biāo)記后保存的方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
tkinter如何實(shí)現(xiàn)label超鏈接調(diào)用瀏覽器打開(kāi)網(wǎng)址
這篇文章主要介紹了tkinter如何實(shí)現(xiàn)label超鏈接調(diào)用瀏覽器打開(kāi)網(wǎng)址問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-01-01
Python還能這么玩之只用30行代碼從excel提取個(gè)人值班表
公司實(shí)行項(xiàng)目值班制度,拿到值班表,看到全部的值班信息,要去查找自己的值班信息,是一件頭痛的事情.作為程序員,當(dāng)然要簡(jiǎn)化,將自己的信息提煉出來(lái),需要的朋友可以參考下2021-06-06
pytorch中的hook機(jī)制register_forward_hook
這篇文章主要介紹了pytorch中的hook機(jī)制register_forward_hook,手動(dòng)在forward之前注冊(cè)hook,hook在forward執(zhí)行以后被自動(dòng)執(zhí)行,下面詳細(xì)的內(nèi)容介紹,需要的小伙伴可以參考一下2022-03-03
Python爬蟲(chóng) 批量爬取下載抖音視頻代碼實(shí)例
這篇文章主要介紹了Python爬蟲(chóng) 批量爬取下載抖音視頻代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-08-08
python實(shí)現(xiàn)美團(tuán)訂單推送到測(cè)試環(huán)境,提供便利操作示例
這篇文章主要介紹了python實(shí)現(xiàn)美團(tuán)訂單推送到測(cè)試環(huán)境,提供便利操作,涉及Python基于requests模塊的網(wǎng)絡(luò)請(qǐng)求與數(shù)據(jù)處理相關(guān)操作技巧,需要的朋友可以參考下2019-08-08
使用matplotlib創(chuàng)建Gif動(dòng)圖的實(shí)現(xiàn)
本文主要介紹了使用matplotlib創(chuàng)建Gif動(dòng)圖的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-04-04
Python基于stuck實(shí)現(xiàn)scoket文件傳輸
這篇文章主要介紹了Python基于stuck實(shí)現(xiàn)scoket文件傳輸,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-04-04
解決Python字典查找報(bào)Keyerror的問(wèn)題
這篇文章主要介紹了解決Python字典查找報(bào)Keyerror的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-05-05

