yangh / uvcvideo

uvcvideo driver with still image capture support
70 stars 48 forks source link

uvcvideo

uvcvideo driver with still image capture support

Background

What's still image capture in UVC?

Refer to the USB Video Class 1.1 spec, 2.4.2.4 Still Image Capture, page 14.

End user's view: it's means you can capture a still image with different size to the current preview size. e.g preview in 800x600, but you wanna still image in 1600x1200.

Technical view: it's means application don't need stream off the current video stream (preview stream), and send a trigger control command to camera, to get a still image frame via the current preview stream pipe line, after still image sent, camera will auto switch back to preview stream, and application continue to show preview stream.

Why we need still image capture mode?

Implementation

Build driver

build for you pc

 cd uvc
 make
 make test

build for your android

 # Setup your android env first
 cd uvc
 make -f Makefile.android
 adb push uvcvideo.ko /data/
 adb shell rmmod uvcvideo
 adb shell insmod /data/uvcvideo.ko
#adb shell "echo 2047 > /sys/module/uvcvideo/parameters/trace"

User space tool

I also customized the famous v4l2 capture.c to do still image capture, and I've successfully captured still image on a live preview stream (I wrote a tool to convert yuv422 raw data into png, and use it to verify the captured still image).

 $> cd v4l2-capture
 $> make

FAQ

How to identify if your uvc camera support still image capture?

lsusb -v -d xxxx:xxxx

Find STILL_IMAGE_FRAME in the output, if found, it does, else not.

TODO

Implement this feature in sub device such as /dev/photo0, so that we don't need a magic number to identify if the IOCTRL is normal or for still image, the driver will more clean than the current implement.

Atuhors

Links