[Webcam PIC] Chapter VBI-3.   Webcam Snaps Using VLC


This chapter does not appear in the book.


The previous chapter was about using JavaCV to take webcam snaps. It does a fine job of processing the webcam's video input as a sequence of images, and is at the core of most of the examples in the rest of this book.

This chapter takes a slight detour to consider snap-taking without JavaCV and OpenCV. One historical reason for this is that some readers of earlier drafts complained about JavaCV's FrameGrabber containing memory leaks and crashing. I've had no such problems on my test machines running Windows XP and 7.

The main reason for exploring alternatives to JavaCV is simply to have more than one tool available for such a core feature as grabbing pictures.

I'm not going to consider the venerable Java Media Framework (JMF), due to its great age and lack of support for 64-bit versions of Windows. For readers who really want to use it, I refer you to my online chapter VBI-3.5 "Webcam Snaps Using JMF".

In the past, I've recommended FMJ, an open-source project which is API-compatible with JMF. Unfortunately, that library is also starting to age, not having changed since 2007. Dust also seems to be settling upon Xuggler, which hasn't been updated since 2011. Readers interested in Xuggler should have a look at my online chapter about video watermarking.

This chapter is about reimplementing JavaCV's FrameGrabber using VLC and its Java binding, vlcj. The resulting class, VLCCapture, is shown in action in the screenshot showed above.

VLCCapture offers a similar interface to JavaCV's FrameGrabber, and so can be substituted for that class with a few lines of changes to the calling application.




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page