【发布时间】:2022-01-27 01:48:08
【问题描述】:
我有一组 jpg 图片。这些图像最初是从电影中拍摄的。它是用 C++ 编写的(我正在解释我是如何获得这些图像以供参考的。这不是问题的主要部分)
cv::Mat test_image;
cv::VideoCapture video_capture;
video_capture.open(test_video_name);
while(true){
video_capture >> test_image;
if (test_image.empty()) break;
std::string input_file_name=get_file_name();
cv::imwrite(input_file_name,test_image);
}
无论如何,我得到了这些图像,我想使用 Python 将它们转换回电影
我是这样的
import cv2 as cv
import glob
glob_arg= image_folder+"/*.jpg"
size=getSize()
out = cv.VideoWriter(output_video,cv.VideoWriter_fourcc(*'DIVX'), 10, size)
for filename in sorted(glob.glob(glob_arg)):
img = cv.imread(filename)
print(filename)
out.write(img)
out.release()
现在,我的问题在于VideoWriter 问题,特别是“10”参数。我怎么知道放在那里的价值?这个参数是每秒的帧数。怎样判断才能与原作有相同或相似的电影?
【问题讨论】:
-
你知道电影长度和图像总数吗?如果没有,我建议从
25开始,因为这是一个非常常见的帧速率。