Code covered by the BSD License  

Highlights from
Simple Video Camera Frame Grabber Toolkit

4.5
4.5 | 2 ratings Rate this file 32 Downloads (last 30 days) File Size: 81.4 KB File ID: #35554 Version: 1.0
image thumbnail

Simple Video Camera Frame Grabber Toolkit

by

 

A toolkit for capturing still frames from Firewire or USB video cameras

| Watch this File

File Information
Description

(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 http://lti-civil.org/). 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.

Required Products MATLAB
MATLAB release MATLAB 7 (R14)
Other requirements See the README file for additional information.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
01 May 2015 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 http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/

Comment only
28 Apr 2015 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?

Comment only
01 Feb 2015 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.

Comment only
31 Jan 2015 Ramesh Ramasamy

Hello,
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
Initializing...
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.lti.civil.impl.jni.NativeCaptureSystemFactory.createCaptureSystem(NativeCaptureSystemFactory.java:24)

at com.academiken.framegrabm.util.GrabCore.init(GrabCore.java:139)

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)

at
com.lti.civil.impl.jni.NativeCaptureSystemFactory.createCaptureSystem(NativeCaptureSystemFactory.java:21)

... 1 more

Error in fgrabm_test (line 12)
fgrabm_init

>> }

12 May 2014 imran

imran (view profile)

Hello,

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

Comment only
28 Mar 2014 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?

Comment only
28 Mar 2014 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.

Comment only
13 Mar 2014 Thomas

Thomas (view profile)

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
Thomas

04 Dec 2013 Zizhou

Zizhou (view profile)

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(QTRuntimeException.java:110)
at java.lang.String.valueOf(String.java:2854)
at java.lang.StringBuilder.append(StringBuilder.java:128)
at java.lang.Throwable.printEnclosedStackTrace(Throwable.java:694)
at java.lang.Throwable.printStackTrace(Throwable.java:666)
at java.lang.Throwable.printStackTrace(Throwable.java:720)
at com.mathworks.jmi.OpaqueJavaInterface.getExceptionMessage(OpaqueJavaInterface.java:1314)
Error using com.academiken.framegrabm.util.GrabCore/init
Failed to retrieve Exception Message

Error in fgrabm_init (line 35)
FGRABM.class.init()

Error in fgrabm_start (line 14)
fgrabm_init

Comment only
03 Jun 2013 Brian

Brian (view profile)

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

Comment only
03 Jun 2013 Brian

Brian (view profile)

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.

java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1122)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1099)
at quicktime.QTSession.<clinit>(QTSession.java:94)
at com.lti.civil.impl.qtjava.QTCaptureSystem.init(QTCaptureSystem.java:35)
at com.academiken.framegrabm.util.GrabCore.init(GrabCore.java:140)
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(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1716)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at quicktime.QTSession$1.run(QTSession.java:96)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:708)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:669)
at java.awt.EventQueue$2.run(EventQueue.java:667)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:678)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
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(QTSession.java:935)
at quicktime.QTSession.open(QTSession.java:641)
at quicktime.QTSession.open(QTSession.java:608)
at
com.lti.civil.impl.qtjava.QTCaptureSystem.init(QTCaptureSystem.java:35)
at
com.academiken.framegrabm.util.GrabCore.init(GrabCore.java:140)

Error in fgrabm_test (line 12)
fgrabm_init

Comment only

Contact us