Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

capture picture from linux command line (uvccapture captures black picture)

As in the topic, when I run:

sudo uvccapture -S40 -C30 -G80 -B20 -x1280 -y720 -v

I get a big black picture (the same result with -m flag)

BUT, when I run:

sudo uvccapture -S40 -C30 -G80 -B20 -x1280 -y720 -v -t5

Which means It will take a picture every 5 seconds.
it works good (picture is ok).
But I can't use that command, cause it won't stop taking pictures.

Do you know what can be wrong?

result:

Using videodevice: /dev/video0  
Saving images to: snap.jpg  
Image size: 1280x720  
Taking snapshot every 0 seconds  
Taking images using mmap  
Resetting camera settings  
ioctl querycontrol error 22  
Setting camera brightness to 20  
Setting camera contrast to 30  
Setting camera saturation to 40  
Setting camera gain to 80  
ioctl querycontrol error 22  
Saving image to: snap.jpg  

lsusb:

Bus 001 Device 004: ID 041e:4088 Creative Technology, Ltd

dmesg:

[3.192732] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[3.321292] usb 1-1.3: New USB device found, idVendor=041e, idProduct=4088
[3.334037] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[3.343098] usb 1-1.3: Product: VF0700 Live! Cam Chat HD
[3.350192] usb 1-1.3: Manufacturer: Creative Technology Ltd.
[3.357531] usb 1-1.3: SerialNumber: 2G130236
[3.949616] udevd[154]: starting version 175
[5.197753] Registered led device: led0
[5.294970] Linux media interface: v0.10
[5.499646] Linux video capture interface: v2.00
[6.009958] uvcvideo: Found UVC 1.00 device VF0700 Live! Cam Chat HD (041e:4088)
[6.210327] input: VF0700 Live! Cam Chat HD as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/input/input0
[6.369436] usbcore: registered new interface driver uvcvideo
[6.502467] USB Video Class driver (1.1.1)
like image 714
Tom Avatar asked Nov 23 '22 16:11

Tom


1 Answers

I observed the same behavior that Tom described above: running uvccapture without specifying a "-t" option results in a black image, while running it with "-t" where N is nonzero captures a valid image every N seconds. After some investigation, I found that uvccapture's initial call to its "grab" function seems to fail, but subsequent calls work OK. Adding a gratuitous call to uvcGrab() just prior to the primary processing loop in main() results in a single valid image being captured when either the "-t0" option or no "-t" option is specified on the command line.

like image 53
Dave L Avatar answered Dec 06 '22 09:12

Dave L