在 Python OpenCV 中发布 VideoWriter

yay*_*990 2 python opencv

有谁知道在python中释放VideoWriter对象的命令是什么?

在我的代码中,我导入以下内容:

import cv2
import cv2.cv as cv
Run Code Online (Sandbox Code Playgroud)

我能找到的文档根本没有说明如何使用 cv2 或 python 释放 videoObject 。这是 OpenCV 2.4.5.0 的文档。

我试过了

cv.ReleaseVideoWriter(videoWriter)
Run Code Online (Sandbox Code Playgroud)

以及使用 cv2 和 cv 的其他随机组合。似乎什么都不起作用。

谢谢!

Abi*_*n K 5

我在Fedora中从其源代码编译了OpenCV 2.4.5,它确实具有发布功能。请参阅我的 IPython 会话,其中演示了此功能。

In [22]: out = cv2.VideoWriter('out.avi', cv2.cv.CV_FOURCC(*'MJPG'), 30.0, (100, 100), False)

In [23]: out.isOpened()
Out[23]: True

In [24]: out.    # Press `Tab`, Just checking available methods, see release is there
out.avi       out.isOpened  out.open      out.release   out.write     

In [24]: out.release()

In [25]: out.isOpened()
Out[25]: False
Run Code Online (Sandbox Code Playgroud)

所以请检查您的版本。