[Nottingham] Webcam snapshots

Martin martin at ml1.co.uk
Mon Oct 31 21:48:18 UTC 2011


> (This is also to get around the problem that you cannot use multiple
> HD webcams on one USB2 hub...)

OK, so I've been having fun trying to get multiple HD webcams to work
reliably... With partial success using uvccapture.

Something better still needed, so...

Anyone any experience of using OpenCV? Comments?

My HD image grab attempt so far is noted below.


Thus far, the best I've come up with is to compile uvccapture from:


and then to use:



# Supported sizes:
# 1024 x 768
# 1280 x 960
# 1400 x 1050
# 1600 x 1200

for d in 0 1 2 3

        /usr/local/bin/uvccapture -o${g}%1d.jpg -d/dev/video${d}
-x1280 -y960 -t1 -n2 -w
        sleep 0.1       # Bodge fix to allow the uvc drivers to clean up!
        echo "v='$v'"
        [ -f "$g" ] && mv -v "$g" "$v"
        [ "$1" == "-v" ] && ls -lh "$v"


That works well enough apart from being horribly slow. I need to take
the second frame from the webcams due to the first usually being badly
exposed or even corrupt. Occasionally, there can be many seconds of
pause before uvccapture responds with an image.

Curiously, trying to use such as ffmpeg to grab an image works ok for
a few times and then hangs on the n-th iteration of switching between
webcams. All works fine if I only use just one webcam...

The hope with using OpenCV is to speed things up and to make the image
grab more reliable. Anyone to comment?

More information about the Nottingham mailing list