wiki:Docs/825gen2/Dev/Devices/USB/Webcams

Version 10 (modified by Don Wilson, 10 months ago) ( diff )

--

USB Web Cams

The 825gen2 has some support for USB cameras.

After plugging a Logitech USB webcam into the 825 from a terminal type dmesg.

card825gen2:~$ dmesg
...
[ 7653.802688] usb 1-1.4: new high-speed USB device number 4 using xhci-hcd
[ 7654.211992] usb 1-1.4: Found UVC 1.00 device <unnamed> (046d:0825)
[ 7654.324569] input: UVC Camera (046d:0825) as /devices/platform/soc@0/38200000.usb/xhci-hcd.0.auto/usb1/1-1/1-1.4/1-1.4:1.0/input/input7
[ 7654.325132] usbcore: registered new interface driver uvcvideo
[ 7655.880687] usb 1-1.4: set resolution quirk: cval->res = 384
[ 7655.881370] usbcore: registered new interface driver snd-usb-audio

This shows the webcam was detected, "registered new interface driver uvcvideo". Many webcams currently are UVC (USB Video Class) compliant. The 825gen2 has support for this.

Type lsmod to show loaded modules

card825gen2:~$ lsmod
Module                  Size  Used by
snd_usb_audio         294912  0
snd_hwdep              20480  1 snd_usb_audio
snd_usbmidi_lib        36864  1 snd_usb_audio
uvcvideo              106496  0
algif_hash             20480  1
algif_skcipher         20480  1
af_alg                 32768  6 algif_hash,algif_skcipher
cardmnbdm              24576  0
rpmsg_ctrl             16384  0
…

The uvcvideo module was loaded automatically when the camera was plugged in and detected.

Capture still image

From the terminal type the following command to capture a still image from the camera.

card825gen2:~$  gst-launch-1.0 v4l2src device=/dev/video2 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
Got EOS from element "pipeline0".
Execution ended after 0:00:02.385972216
Setting pipeline to NULL ...
Freeing pipeline ...

The file /tmp/test.jpg contains the image.

To capture an image from an app a system call could be used to perform the above command line. However, it would be better to use the gstreamer library within the code. An example of this will be added to this page at a later date.

Note: See TracWiki for help on using the wiki.