Hi All, I've wrote a little test program to a extract a frame of a video file (for processing), but I can't get it work. The video file is a compressed avi file, and can be played by the camshift.py demo of OpenCv. So I think the OpenCv bindings for python are installed correctly. import skimage from skimage.io import Video vid = Video('c:\\test.avi') frame0 = vid.get() However the above test program gives the following error: Traceback (most recent call last): File "C:\prog\skimage-test.py", line 8, in <module> frame0 = vid.get() File "C:\Python\lib\site-packages\scikits_image-0.4.2-py2.6-win32.egg\skimage\io\video.py", line 279, in get return self.video.get() File "C:\Python\lib\site-packages\scikits_image-0.4.2-py2.6-win32.egg\skimage\io\video.py", line 54, in get cv.Copy(img, img_mat) TypeError: CvArr argument 'dst' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND I used the following versions of the software Python 2.6.4 Numpy 1.6.1 Scipy 0.9.0 skimage 0.4.2 OpenCv 2.3.1 (Rev: 4557) PyQt 4.6.2 WinXp Sp3 Am I doing something wrong? Or is there just a specific version of OpenCv required? Note that OpenCv isn't on the (optional) requirements list. I also tried to install the alternative backend, gstreamer+python bindings, but under windows this seems to be troublesome. kind regards, Robbert
Hi Robbert On Sat, Dec 17, 2011 at 7:50 AM, robbert <superslimme@netscape.net> wrote:
I've wrote a little test program to a extract a frame of a video file (for processing), but I can't get it work.
Thanks for the report. This works using GStreamer, so tomorrow I'll compile OpenCV and determine what the problem is. Regards Stéfan
I don't think skimage 0.4.2 works with OpenCv 2.3.1. Video.py tries `import cv` but in OpenCv 2.3.1 the cv module was moved to cv2.cv. Try change `import cv` to `from cv2 import cv` in video.py. Christoph On 12/17/2011 7:50 AM, robbert wrote:
Hi All,
I've wrote a little test program to a extract a frame of a video file (for processing), but I can't get it work. The video file is a compressed avi file, and can be played by the camshift.py demo of OpenCv. So I think the OpenCv bindings for python are installed correctly.
import skimage from skimage.io import Video vid = Video('c:\\test.avi') frame0 = vid.get()
However the above test program gives the following error:
Traceback (most recent call last): File "C:\prog\skimage-test.py", line 8, in <module> frame0 = vid.get() File "C:\Python\lib\site-packages\scikits_image-0.4.2-py2.6-win32.egg\skimage\io\video.py", line 279, in get return self.video.get() File "C:\Python\lib\site-packages\scikits_image-0.4.2-py2.6-win32.egg\skimage\io\video.py", line 54, in get cv.Copy(img, img_mat) TypeError: CvArr argument 'dst' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND
I used the following versions of the software Python 2.6.4 Numpy 1.6.1 Scipy 0.9.0 skimage 0.4.2 OpenCv 2.3.1 (Rev: 4557) PyQt 4.6.2 WinXp Sp3
Am I doing something wrong? Or is there just a specific version of OpenCv required? Note that OpenCv isn't on the (optional) requirements list.
I also tried to install the alternative backend, gstreamer+python bindings, but under windows this seems to be troublesome.
kind regards,
Robbert
Correction: OpenCV 2.3.1 provides a compatibility module, cv.py, which does `from cv2.cv import *`. So this is not the problem. Christoph On 12/17/2011 4:34 PM, Christoph Gohlke wrote:
I don't think skimage 0.4.2 works with OpenCv 2.3.1. Video.py tries `import cv` but in OpenCv 2.3.1 the cv module was moved to cv2.cv. Try change `import cv` to `from cv2 import cv` in video.py.
Christoph
On 12/17/2011 7:50 AM, robbert wrote:
Hi All,
I've wrote a little test program to a extract a frame of a video file (for processing), but I can't get it work. The video file is a compressed avi file, and can be played by the camshift.py demo of OpenCv. So I think the OpenCv bindings for python are installed correctly.
import skimage from skimage.io import Video vid = Video('c:\\test.avi') frame0 = vid.get()
However the above test program gives the following error:
Traceback (most recent call last): File "C:\prog\skimage-test.py", line 8, in <module> frame0 = vid.get() File "C:\Python\lib\site-packages\scikits_image-0.4.2-py2.6-win32.egg\skimage\io\video.py", line 279, in get return self.video.get() File "C:\Python\lib\site-packages\scikits_image-0.4.2-py2.6-win32.egg\skimage\io\video.py", line 54, in get cv.Copy(img, img_mat) TypeError: CvArr argument 'dst' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND
I used the following versions of the software Python 2.6.4 Numpy 1.6.1 Scipy 0.9.0 skimage 0.4.2 OpenCv 2.3.1 (Rev: 4557) PyQt 4.6.2 WinXp Sp3
Am I doing something wrong? Or is there just a specific version of OpenCv required? Note that OpenCv isn't on the (optional) requirements list.
I also tried to install the alternative backend, gstreamer+python bindings, but under windows this seems to be troublesome.
kind regards,
Robbert
participants (3)
-
Christoph Gohlke -
robbert -
Stéfan van der Walt