Skip to content Skip to sidebar Skip to footer

Release Videowriter In Python Opencv

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 doe

Solution 1:

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.openout.release   out.write     

In [24]: out.release()

In [25]: out.isOpened()
Out[25]: False

So please check your version.

Solution 2:

This worked for me:

videoWriter = None

Source: "OpenCV Computer Vision with Python, by Joseph Howse", chapter 2.

Post a Comment for "Release Videowriter In Python Opencv"