videostabilization.docx


立即下载 满目山河
2024-04-21
video self.prev self.video.get cv2 int Calculate 机器 Color cv2.cvt
14.7 KB

import cv2
import numpy as np
import pandas as pd
import tqdm
import imutils
import os
class VideoStabilizer:
def __init__(self, video_in_path, video_out_path, side_by_side=False, crop_percent=None, max_width=500):
# Initialize arguments
self.video_in_path = video_in_path
self.video_out_path = video_out_path
self.side_by_side = side_by_side
self.crop_percent = crop_percent
self.max_width = max_width
print("1")
# Set up video capture
self.video = cv2.VideoCapture(self.video_in_path)
self.n_frames = int(self.video.get(cv2.CAP_PROP_FRAME_COUNT))
self.fps = int(self.video.get(cv2.CAP_PROP_FPS))
# Read 'prev', convert to greyscale and get dimensions
_, self.prev = self.video.read()
self.prev_g = cv2.cvtColor(self.prev, cv2.COLOR_BGR2GRAY)
(self.frame_h, self.frame_w) = self.prev_g.shape
print('[INFO]: Setup completed')
print("2")
# Calculate


video/self.prev/self.video.get/cv2/int/_out_path/Calculate/机器/Color/cv2.cvt/ video/self.prev/self.video.get/cv2/int/_out_path/Calculate/机器/Color/cv2.cvt/
-1 条回复
登录 后才能参与评论
-->