File Exchange

image thumbnail

Simple Video Camera Frame Grabber Toolkit

version (81.4 KB) by Kenneth Perrine
A toolkit for capturing still frames from Firewire or USB video cameras


Updated 10 Mar 2012

View License

(Version 0.8)

The FrameGrabM toolkit provides a quick way to grab still frames from a live video source, such as a FireWire video camera or a USB webcam. Individual video frames are returned to MATLAB as a matrix of RGB values. The toolkit uses LTI-CIVIL, a Java-based library instigated by Ken Larson for capturing images (see Please refer to the README file for instructions on how to download and install LTI-CIVIL.

Key features of FrameGrabM:
- Targeted for Windows, Mac OS X, and Linux x86 and x64
- No need for MATLAB Image Acquisition Toolbox
- Simultaneous capture from multiple video devices

It's easy! Here is an example MATLAB script for capturing a video frame from the default capture device:

fgrabm_start % Initialize the framework and start capture
pause(2) % Wait for the capture device to warm up
pixels = fgrabm_grab(); % Grab the most recent frame and return data
image(pixels) % Display the pixels
fgrabm_shutdown % Uninitialize the capture framework

Please look at the README file for details on installation, as MATLAB's Java library path in its librarypath.txt and classpath.txt files must be configured to refer to included LTI-Civil native library files. Depending upon how MATLAB was installed, you may need administrative/root privileges to successfully perform these changes. README also contains special information pertaining to the Mac OS X platform.

Note that this is a preliminary release and I welcome feedback that can help lead to a final version. See README for more details.

Cite As

Kenneth Perrine (2021). Simple Video Camera Frame Grabber Toolkit (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

Kenneth Perrine

1. For OpenCV, there are no updates yet... but there are plans in the works.

2. Clearly, with the OpenCV implementation, 64-bit and Mac OSX will be supported. But, there has not been progress with the current back end.

3. For monochrome, when you run FGRABM_GRAB, it returns image data with dimensions (rows,cols,3), where the 3 elements in the last dimension are red, green, and blue components. Since green encompasses most of the luminance in the human perception system, taking just the green components should get you a good image. But, you can also do a grayscale conversion as seen in the luminocity technique at

Zachary Hillman

1) Any update to using OpenCV library?
2) using Mac OSX and 64 bit?
3) how can this be changed, or does it even need changing, to get grey/monochrome/ images?

Kenneth Perrine

Ramesh, thanks for posting about your problem in using this library in the 64-bit environment. I don't know why there is no provided 64-bit Windows library linked into LTI-Civil. As a workaround, I suggest trying to run MATLAB in 32-bit mode as described in Part D of the Readme file. (Just do the same thing as the instructions for OS X).

Meanwhile, I do have in mind to replace the back-end of this library with something that's updated. Check back later for that, and please send any encouragements you have for doing this.

Ramesh Ramasamy

Is this type of installation support for 64 bit Windows 8.1 OS? i got the following error.hoping for a favorable response { fgrabm_test
Error using fgrabm_init (line 35)
Java exception occurred:
com.lti.civil.CaptureException: java.lang.UnsatisfiedLinkError:
E:\R2012b\FRAMEGRABM\lti-civil-20070920-1721\native\win32-x86\civil.dll: Can't load IA
32-bit .dll on a AMD 64-bit platform


at com.academiken.framegrabm.util.GrabCore.init(

Caused by: java.lang.UnsatisfiedLinkError:
E:\R2012b\FRAMEGRABM\lti-civil-20070920-1721\native\win32-x86\civil.dll: Can't load IA
32-bit .dll on a AMD 64-bit platform

at java.lang.ClassLoader$NativeLibrary.load(Native Method)

at java.lang.ClassLoader.loadLibrary0(Unknown Source)

at java.lang.ClassLoader.loadLibrary(Unknown Source)

at java.lang.Runtime.loadLibrary0(Unknown Source)

at java.lang.System.loadLibrary(Unknown Source)


... 1 more

Error in fgrabm_test (line 12)

>> }



I am working on a project which consist to controlling two FireWire camera simultaneously, I tried to install your frame grabber kit but when I installed I have got an error message :

Unrecognized token, etc..

How do I install this kit for Matlab 64bit version ?

Kind regards

Kenneth Perrine

Thomas, supposedly the underlying LTI-Civil library can capture from two cameras simultaneously. And I had seen it work! But, I have had experiences, too, where the computer freezes up when I capture two simultaneous images. The problem seems to worsen when the images being captured are higher resolution or the frame rate is higher. I suggest trying the following: 1. A faster computer; 2. Separate USB buses (e.g. install a separate USB controller and put one camera on that); 3. FireWire cameras instead of USB cameras; 4. Decreasing the resolution and/or the frame rate. I would like to know if any of these options work for you. Longer-term, I have had better experience with the OpenCV library and am considering updating the software to use that instead of LTI-Civil. Maybe that will help with the 64-bit Mac problems too?

Kenneth Perrine

Zizhou and Brian, I have had troubles getting LTI-Civil to work with QuickTime video capture in 64-bit Mac/OS. I don't know if it is possible for the current system to actually work. Sorry I can't be of further help.


Hello. I am currently working on a project with stereovision on my university.
I have successfully downloaded and installed this toolkit you have made.
My question is, how is it possible for me to get a stereoscopic picture with this toolkit?
When "fgrabm_test" is called, I recive a picture from my integrated webcam(camera1), I can also change the default to USB webcam1(camera2) or USB webcam2(camera3) and get pictures from them,but only one bye one.
When I run the "sample_twocams" it starts running and Matlab is "busy" but Matlab runs forever and nothing will work and eventually Matlab is not responding to anything so I have to manually shut down Matlab.

For my project I need one picture from camera2 and camera3 taken
simultaneously, so I then can load the pictures to another Matlab script I have and do some tests.

Really hope you guys can be able to help me with this, much appreciated.

Best regards


I got the following error when I run fgarbm_start

environment: maxos 64, matlab 2013b

>> fgrabm_start
java.lang.NoClassDefFoundError: Could not initialize class quicktime.QTSession
at quicktime.QTRuntimeException.toString(
at java.lang.String.valueOf(
at java.lang.StringBuilder.append(
at java.lang.Throwable.printEnclosedStackTrace(
at java.lang.Throwable.printStackTrace(
at java.lang.Throwable.printStackTrace(
at com.mathworks.jmi.OpaqueJavaInterface.getExceptionMessage(
Error using com.academiken.framegrabm.util.GrabCore/init
Failed to retrieve Exception Message

Error in fgrabm_init (line 35)

Error in fgrabm_start (line 14)


I also tried changing to 32bits as you mention in the readme but then I am unable to startup matlab.


First thank you for writing the code.
I just want to say I tried using it on Mac Osx (10.8.3) w/matlab 2013a and this is the error I get. It seems to have a problem with the native library however I am sure I followed the installation procedures correctly.

at java.awt.EventQueue.invokeAndWait(
at java.awt.EventQueue.invokeAndWait(
at quicktime.QTSession.<clinit>(
at com.lti.civil.impl.qtjava.QTCaptureSystem.init(
at com.academiken.framegrabm.util.GrabCore.init(
Caused by: java.lang.UnsatisfiedLinkError: /System/Library/Java/Extensions/libQTJNative.jnilib: no suitable image found. Did find: /System/Library/Java/Extensions/libQTJNative.jnilib: mach-o, but wrong architecture
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(
at java.lang.ClassLoader.loadLibrary(
at java.lang.Runtime.loadLibrary0(
at java.lang.System.loadLibrary(
at quicktime.QTSession$
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$400(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
Error using fgrabm_init (line 35)
Java exception occurred:
java.lang.UnsatisfiedLinkError: quicktime.QTSession.Gestalt(I[I)S
at quicktime.QTSession.Gestalt(Native Method)
at quicktime.QTSession.gestalt(

Error in fgrabm_test (line 12)

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!