[Bug 321358] [NEW] v4l2 image capture doesn't work
Ethan Townsend
etownsend at gmail.com
Mon Jan 26 07:02:06 UTC 2009
Public bug reported:
Binary package hint: libcv-dev
using libcv-dev and libcv1 version 1.0.0-6.1 on kubuntu 8.10 amd64.
trying to initialize v4l2 via the demo programs (in c or python) fails with "Could not initialize capturing..." for the c programs or
"Error opening capture device" for python programs. The demo programs that did not involve webcam capture work as expected. /dev/video0 exists and works with cheese, skype, etc. I tried 2 webcams, one was a logitech with the following output from v4l-info
>### v4l2 device info [/dev/video0] ###
>general info
> VIDIOC_QUERYCAP
> driver : "zc3xx"
> card : "USB Camera (046d:08d7)"
> bus_info : "0000:00:02.0"
> version : 2.2.0
> capabilities : 0x5000001 [VIDEO_CAPTURE,READWRITE,STREAMING]
and dmesg output
>[21413.628051] usb 1-7: new full speed USB device using ohci_hcd and address 8
>[21413.833749] usb 1-7: configuration #1 chosen from 1 choice
>[21413.837178] gspca: probing 046d:08d7
>[21415.711809] zc3xx: probe 2wr ov vga 0x0000
>[21415.783806] zc3xx: probe sensor -> 11
>[21415.783819] zc3xx: Find Sensor HV7131R(c)
>[21415.805489] gspca: probe ok
>[21415.807305] gspca: probing 046d:08d7
and one creative labs webcam with this output:
>### v4l2 device info [/dev/video0] ###
>general info
> VIDIOC_QUERYCAP
> driver : "zc3xx"
> card : "USB Camera (041e:401c)"
> bus_info : "0000:00:02.0"
> version : 2.2.0
> capabilities : 0x5000001 [VIDEO_CAPTURE,READWRITE,STREAMING]
Both produced identical results with opencv.
I also tried running this python script:
>import pygame
>import Image
>from pygame.locals import *
>import sys
>
>import opencv
>#this is important for capturing/displaying images
>from opencv import highgui
>
>camera = highgui.cvCreateCameraCapture(0)
>def get_image():
> im = highgui.cvQueryFrame(camera)
> # Add the line below if you need it (Ubuntu 8.04+)
> im = opencv.cvGetMat(im)
> #convert Ipl image to PIL image
> return opencv.adaptors.Ipl2PIL(im)
>
>fps = 30.0
>pygame.init()
>window = pygame.display.set_mode((640,480))
>pygame.display.set_caption("WebCam Demo")
>screen = pygame.display.get_surface()
>
>while True:
> events = pygame.event.get()
> for event in events:
> if event.type == QUIT or event.type == KEYDOWN:
> sys.exit(0)
> im = get_image()
> pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
> screen.blit(pg_img, (0,0))
> pygame.display.flip()
> pygame.time.delay(int(1000 * 1.0/fps))
This script fails with the following output:
>Traceback (most recent call last):
> File "test.py", line 29, in <module>
> im = get_image()
> File "test.py", line 14, in get_image
> im = opencv.cvGetMat(im)
> File "/var/lib/python-support/python2.5/opencv/cv.py", line 3826, in cvGetMat
> return _cv.cvGetMat(*args)
>RuntimeError: openCV Error:
> Status=Null pointer
> function name=cvGetMat
> error message=NULL array pointer is passed
> file_name=cxarray.cpp
> line=2780
I am new with v4l2 and opencv, I apologize if this bug should be filed
under the zc3xx/gspca drivers, I have no way to test other webcam
modules.
** Affects: opencv (Ubuntu)
Importance: Undecided
Status: New
--
v4l2 image capture doesn't work
https://bugs.launchpad.net/bugs/321358
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
More information about the universe-bugs
mailing list