无法使用OpenCV创建基本视频文件

2024-04-25 23:52:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用OpenCV(在Python中)创建一个基本的视频文件。我有以下代码,运行时没有任何错误,但没有看到创建的输出文件。我想知道有没有人知道出了什么问题。

from cv import *
im1 = LoadImage("/home/spoll/laptop1.jpg")
im2 = LoadImage("/home/spoll/laptop2.jpg")

writer = CreateVideoWriter("/home/spoll/out", CV_FOURCC('F', 'L', 'V', '1'), 2, (im1.width, im1.height))
if writer is None:
    print "Error in creating video writer"
else:
    print WriteFrame(writer, im1)
    print WriteFrame(writer, im2)

谢谢!


Tags: 文件代码fromhome错误opencvwriterjpg