v4l2 image capture doesn't work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
opencv (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
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_
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_
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/
>from opencv import highgui
>
>camera = highgui.
>def get_image():
> im = highgui.
> # Add the line below if you need it (Ubuntu 8.04+)
> im = opencv.cvGetMat(im)
> #convert Ipl image to PIL image
> return opencv.
>
>fps = 30.0
>pygame.init()
>window = pygame.
>pygame.
>screen = pygame.
>
>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.
> screen.blit(pg_img, (0,0))
> pygame.
> pygame.
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/
> return _cv.cvGetMat(*args)
>RuntimeError: openCV Error:
> Status=Null pointer
> function name=cvGetMat
> error message=NULL array pointer is passed
> file_name=
> 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.
Got the same here. Can't get a capture object from openCV, c++ or python.
v4l-info output:
### v4l2 device info [/dev/video0] ###
capabilities : 0x5000001 [VIDEO_ CAPTURE, READWRITE, STREAMING]
general info
VIDIOC_QUERYCAP
driver : "zc3xx"
card : "USB Camera (046d:08da)"
bus_info : "0000:00:1a.1"
version : 2.2.0
standards
inputs ENUMINPUT( 0)
VIDIOC_
index : 0
name : "zc3xx"
type : CAMERA
audioset : 0
tuner : 0
std : 0x0 []
status : 0x0 []
video capture ENUM_FMT( 0,VIDEO_ CAPTURE) G_FMT(VIDEO_ CAPTURE)
fmt.pix. width : 640
fmt.pix. height : 480
fmt.pix. pixelformat : 0x4745504a [JPEG]
fmt.pix. field : NONE
fmt.pix. bytesperline : 640
fmt.pix. sizeimage : 115790
fmt.pix. colorspace : JPEG
fmt.pix. priv : 0
VIDIOC_
index : 0
type : VIDEO_CAPTURE
flags : 1
description : "JPEG"
pixelformat : 0x4745504a [JPEG]
VIDIOC_
type : VIDEO_CAPTURE
dmesg:
[ 2850.920016] usb 2-2: new full speed USB device using uhci_hcd and address 5
[ 2851.107640] usb 2-2: configuration #1 chosen from 1 choice
[ 2851.110485] gspca: probing 046d:08da
[ 2852.731236] zc3xx: probe 2wr ov vga 0x0000
[ 2852.775233] zc3xx: probe sensor -> 11
[ 2852.775240] zc3xx: Find Sensor HV7131R(c)
[ 2852.781350] gspca: probe ok
[ 2852.781404] gspca: probing 046d:08da
[ 2922.931570] zc3xx: probe 2wr ov vga 0x0000
[ 2995.611915] zc3xx: probe 2wr ov vga 0x0000