Does anybody know what the command to release a VideoWriter object in python is?
In my code I import the following:
import cv2
import cv2.cv as cv
The documentation I can find does not say how to release the videoObject using cv2 or python at all. That is the documentation for OpenCV 2.4.5.0.
I've tried
cv.ReleaseVideoWriter(videoWriter)
and other random combinations using cv2 and cv. Nothing seems to work.
Thanks!
解决方案
I compiled OpenCV 2.4.5 from its source in Fedora, and it does have a release function. Please see my IPython session which demonstrates this feature.
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
So please check your version.