Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Video capture issue

I am having trouble with the following simple code snippet:


import cv2.cv as cv capture = cv.CaptureFromFile('C://video.mp4') frame = cv.QueryFrame(capture) frame_size = cv.GetSize(frame)


cv.GetSize give this error: error: Array should be CvMat or IplImage

frame is of type <type 'nonetype'="">, so QueryFrame is not returning properly. capture seems to be ok. It is type <type 'cv2.capture'=""> and has a valid looking value: <capture 03673420="">.

Here are the details of my setup: Python 2.7.3 OpenCv 2.4.2 OS = Windows 7 I can view the video.mp4 file in windows media player. I can open jpg files successfully with: frame = cv.LoadImageM('C://test.jpg',cv.CV_LOAD_IMAGE_COLOR);

Whatever I do, I haven't been able to open video files with openCV.

Any suggestions?

Thanks!

click to hide/show revision 2
No.2 Revision

Video capture issueissue in python

I am having trouble with the following simple code snippet:


import cv2.cv as cv
capture = cv.CaptureFromFile('C://video.mp4') 
frame = cv.QueryFrame(capture)
frame_size = cv.GetSize(frame)cv.GetSize(frame)

cv.GetSize gives this error:


cv.GetSize give this error:

error: Array should be CvMat or IplImage

IplImage

frame is of type <type 'nonetype'="">, 'NoneType'>, so QueryFrame is not returning properly. capture seems to be ok. It is type <type 'cv2.capture'=""> 'cv2.Capture'> and has a valid looking value: <capture 03673420="">.

<Capture 03673420>.

Here are the details of my setup: setup: Python 2.7.3 OpenCv 2.4.2 2.7.3, OpenCV 2.4.2, OS = Windows 7 7.

I can view the video.mp4 file in windows media player. player. I can open jpg files successfully with: with:

frame = cv.LoadImageM('C://test.jpg',cv.CV_LOAD_IMAGE_COLOR);

cv.LoadImageM('C://test.jpg',cv.CV_LOAD_IMAGE_COLOR);

Whatever I do, I haven't been able to open video files with openCV.

OpenCV. Any suggestions?

Thanks!

click to hide/show revision 3
No.3 Revision

Video capture issue in python

I am having trouble with the following simple code snippet:

import cv2.cv as cv
capture = cv.CaptureFromFile('C://video.mp4') 
frame = cv.QueryFrame(capture)
frame_size = cv.GetSize(frame)

cv.GetSize gives this error:

error: Array should be CvMat or IplImage

frame is of type <type 'NoneType'>, 'nonetype'="">, so QueryFrame is not returning properly. properly. capture seems to be ok. It is type <type 'cv2.Capture'> 'cv2.capture'=""> and has a valid looking value: <Capture 03673420>. <capture 03673420="">.

Here are the details of my setup: Python 2.7.3, OpenCV 2.4.2, OS = Windows 7.

I can view the video.mp4 file in windows media player. I can open jpg files successfully with:

frame = cv.LoadImageM('C://test.jpg',cv.CV_LOAD_IMAGE_COLOR);

Whatever I do, I haven't been able to open video files with OpenCV. Any suggestions?