Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Kinect IMAQ Adaptor for Matlab

65 views
Skip to first unread message

Gus Lott

unread,
Nov 23, 2010, 8:00:24 PM11/23/10
to
http://matkinect.sourceforge.net/

I just put up an open source Image Acquisition Toolbox adaptor for Matlab that interface the new Microsoft Kinect USB depth camera (controller for the XBOX 360). The adaptor allows for 30Hz streaming of 11-bit depth data at 640x480 from an arbitrary number of Kinect sensors plugged into your Windows 32 based machine.

I built this primarily for the OpenKinect community but thought I'd post it here since it seemed relevant.

Here's the youtube vid demoing my adaptor.
http://www.youtube.com/watch?v=njstg3jnCg0

In my opinion, this is the most efficient way to connect the kinect data stream into Matlab. It is, however, difficult to create two simultaneous streams from a single device (i.e. the RGB and the 11-bit depth images), so I'm currently only streaming in the depth information.

A few options might be to stack the images together in one large frame that is 640x(480*5) for 8-bit RGB and 16-bit depth. But currently, the IMAQ toolbox only supports a 1 or 3 plane frame and the planes have to be a single fixed bit depth. You can have multiple "sources" for a given hardware, but seem to only be able to pull from one source at a time.

It also provides tilt motor control. I've thrown the compiled adaptor dll, installation instructions, and the entire codebase up on a quickly thrown together sourceforge site.

Hopefully this will enable some engineers/scientists who don't otherwise have C/C++ capabilities to jump into some applications with kinect. It should also scale with an arbitrary number of kinects creating multiple threaded interfaces into Matlab without burdening the command line.

The code is a Visual Studio 2008 C++ project the leverages Zephod's win32 kinect driver library downloaded off the OpenKinect site (version 1.5).

Cheers,
-Gus Lott

Paul

unread,
Nov 26, 2010, 8:11:03 AM11/26/10
to
Fantastic! This looks like it could be fun. Can't wait for you to get the RGB channels streaming with the bit depth. Good luck!

"Gus Lott" <lottg....@janelia.hhmi.org> wrote in message <icho38$g7g$1...@fred.mathworks.com>...

Javier

unread,
Nov 26, 2010, 10:15:05 AM11/26/10
to
Paul I have a technical question. How to plug the Kinect trick USB to the normal PC hub.

Thanks

Javier

"Gus Lott" <lottg....@janelia.hhmi.org> wrote in message <icho38$g7g$1...@fred.mathworks.com>...

Gus Lott

unread,
Nov 29, 2010, 7:57:04 AM11/29/10
to
I'm continuing to work with this and having issues figuring out how to best get the RGB data into Matlab. I could switch to using custom getters in the IMAQ adaptor since the IMAQ is only designed to stream one data type into Matlab while the kinect generates two asynchronous streams from a given hardware. One is 8-bit RGB the other is 16-bit (11 actually) depth info. And I can't create two separate adaptors since I couldn't connect to the same hardware twice (imaq adaptors are pretty isolated within the matlab process).

I'll probably just end up creating a custom getter function for a property that will hand a depth array back to matlab. It's still not easy to create array properties of an IMAQ adaptor, however, so it may end up with the grayscale depth image unraveled into a long vector that needs to be reshaped. Not ideal.

I wish mathworks would just provide a way of comprehensively integrating multithreaded code into the workspace.

"Paul " <paul.s...@uea.ac.uk> wrote in message <icobl7$emj$1...@fred.mathworks.com>...

Jeremi

unread,
Jan 4, 2011, 8:50:32 PM1/4/11
to
"Gus Lott" wrote in message <id07v0$fff$1...@fred.mathworks.com>...

Hi Gus,

Thanks so much for building this adapter. I have successfully installed the OpenKinect drivers and am able to register the adapter. Selecting the "DepthImage" format causes my Matlab to crash. Any thoughts on what is going on? The only error message tells me the program has stopped responding.

I am running:

Matlab 7.10.0.499 (R2010a) 32-bit
Image Acquisition Toolbox 3.5 (R2010a)
Windows 7 Home 32-bit

I am able to open some .exe examples from OpenKinect but am looking to capture the data from the depth cameras. Any help would be appreciated.

Jeremi

Husam Aldahiyat

unread,
Jan 5, 2011, 12:40:24 AM1/5/11
to
Great news!

I'm buying a Kinect now.

Deborah Aks

unread,
Jan 24, 2011, 10:45:05 PM1/24/11
to
Hi Gus-- 'm just trying out your Kinect adaptor. Great to see Matlab development on Kinect/NUI. I very much look forward to your future resolution of multi-streaming depth & RGB. Thanks 4 your efforts. --deb

"Gus Lott" wrote in message <icho38$g7g$1...@fred.mathworks.com>...

Kalla

unread,
Jan 27, 2011, 7:36:04 AM1/27/11
to
Great great great!!!

Gus Lott

unread,
Jan 27, 2011, 11:19:04 AM1/27/11
to
It seems like it is not going to be possible to stream both the depth and the RGB images simultaneously because of the way that the IMAQ toolbox handles connections and data sharing. A videoinput object appears to be a stand-alone entity and I don't see how I can create a connection to the kinect and then stream it into 2 videoinput objects. That's what seems to be required to pump both a 16bit grayscale image and a 24 bit RGB image into matlab via this method.

It could work separately (either/or). I wish Matlab would setup a more generic way to pump data into the workspace from parallel threads within the matlab process. Would really kick their capacity for application development into gear. It'd be very similar to the DAQ and IMAQ toolboxes.

Kalla

unread,
Jan 27, 2011, 2:30:08 PM1/27/11
to
"Gus Lott" wrote in message <ihs5to$h89$1...@fred.mathworks.com>...

> It seems like it is not going to be possible to stream both the depth and the RGB images simultaneously because of the way that the IMAQ toolbox handles connections and data sharing. A videoinput object appears to be a stand-alone entity and I don't see how I can create a connection to the kinect and then stream it into 2 videoinput objects. That's what seems to be required to pump both a 16bit grayscale image and a 24 bit RGB image into matlab via this method.
>
> It could work separately (either/or). I wish Matlab would setup a more generic way to pump data into the workspace from parallel threads within the matlab process. Would really kick their capacity for application development into gear. It'd be very similar to the DAQ and IMAQ toolboxes.

Have you checked it out?
http://www.mathworks.com/matlabcentral/linkexchange/links/2718-kinect-for-matlab

I think this can stream both depth and the RGB images simultaneously.

Gus Lott

unread,
Jan 27, 2011, 4:10:04 PM1/27/11
to
"Kalla" wrote in message <ihsh40$79t$1...@fred.mathworks.com>...

>
> Have you checked it out?
> http://www.mathworks.com/matlabcentral/linkexchange/links/2718-kinect-for-matlab
>
> I think this can stream both depth and the RGB images simultaneously.

Streaming? Mex files can't call back into the matlab process (at least not easily or supported by mathworks), so this is a polled interface that will block the command line when called. I didn't look in detail, but that limitation is why I went with an IMAQ adaptor. Matlab has created DAQ and IMAQ toolbox interfaces in order to manage, in a thread safe manner, the passing of data from a separate thread to the workspace. The IMAQ adaptor also gives you callbacks that you can respond to asynchronously in a larger application.

But it may be that they've worked around that in the above link. Cool stuff.

khaled emam

unread,
Mar 29, 2011, 5:22:04 AM3/29/11
to
Hello, am a newbie to dealing with matlab and .DLL files and i am required to do an image processing project with kinect on matlab

>> imaqregister('F:\Documents\MATLAB\matkinect.dll')
??? Error using ==> imaqregister at 89
'F:\Documents\MATLAB\matkinect.dll' is not a valid adaptor. Was the shared library
created using the Image Acquisition Toolbox Adaptor Kit?

thats what i got. if you could tell me another method to add the kinect adaptor it would be highly appreciated.
thanks

am working on matlab 2010a and 32-bit processor

Chinmay Chinara

unread,
Mar 21, 2013, 3:18:06 AM3/21/13
to
"khaled emam" <kh...@hotmail.com> wrote in message <ims8bs$hd1$1...@fred.mathworks.com>...
Even I am having the same problem as I am a newbie at Kinect interfacing....need a solution to this error...
0 new messages