您好,登錄后才能下訂單哦!
需要畫框取消注釋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對視頻畫框標記后保存的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持億速云。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。