Kinect Test

<< Kinect Resource
This page list the steps I took to test Kinect on Mac OS X. The aim is to make it work on Mac OS X in a programmer-friendly way to quicken the development in higher level (HCI, gesture recognition, and image processing). I combined sources from various open source projects (see Acknowledgement section). This page is currently maintained by Chat.

Framework is available in the internal git:

git clone ssh://oliver.informatik.rwth-aachen.de/Public/Research%20Projects/Kinect/Code/KinectFramework.git

Relatively Stable Stuff

  • 14.11.10: KinectFramework (32-bit, 64-bit, Source) Changed depth image to RGB to cover 16-bit data of the depth.
  • 14.11.10: KinectFramework example (64-bit App Bundle, Source) Changed display to NSImageView which is faster than IKImageView.

Latest Hackaround

  • 14.11.10: KinectFramework (32-bit, 64-bit, Source) Changed depth image to RGB to cover 16-bit data of the depth.
  • 14.11.10: KinectFramework example (64-bit App Bundle, Source) Changed display to NSImageView which is faster than IKImageView.

* 14.11.10: KinectFramework—the first attempt to create a newbie-friendly OS X flavor framework. The framework connects to one Kinect and feed CGImageRef of depth and RGB to the designated delegate. (Framework, Example Project, Source) (x86_64 only, for i386 use the source project and change libusb1.0.dylib to the 32-bit version)
* 13.11.10: qdot published a patch for Mac OS X to improve USB buffering. It runs nicely now. (video)
* 12.11.10: I tried to be independent of cmake and libusb, because I don't like the fact that the developer have to go though painful steps of installing and making. The immediate result is a hacked-around Xcode project that include libusb.dylib and OpenKinect. Note that all codes belongs to the respective contributor, I just try to pack it up such that it is less painful for academic mac developers. Please don't sue me. Xcode Project.
** Usage: Open Xcode project, build, and run. If you are on Mac OS X 10.5, replace the libusb.dylib with libusb.dylib-32bit. You don't need to install CMake or libusb on your system.

A Hard, But Legal Way

Software

  • CMake
  • libusb 1.0.8 get it by: git clone git://git.libusb.org/libusb.git (downloading the zip from Sourceforge won't work)
  • OpenKinect project (reference commit: a676d10a8a01fcbff8d2)


All software are cached on oliver/Software/Device Dependent Software/Kinect

Compiling

Below libusb stands for the root of LIBUSBPATH source, and OKPATH stands for the root of OpenKinect source

  • Install CMake. (I use the binary version.)
  • patch libusb
cd LIBUSBPATH

patch -p0 < OKPATH/platform/osx/libusb-osx-kinect.diff
  • compile and install libusb
cd LIBUSBPATH

./autogen.sh
make
sudo make install
  • Since the previous step doesn't install the header files. (I don't know how to do so.) I have to manually tell cmake where the header file is. Also note that I chose to generate Xcode project by passing "Xcode" after -G. If you want to generate a UNIX Makefiles, you can pass "Unix Makefiles" instead.
cd OKPATH/c

mkdir build
cd build
cmake -D USB_INCLUDE_DIR=LIBUSBPATH/libusb -G Xcode ..
  • The interactive screen of ccmake will appear. Press "c" once to start configure. Then, press "c" again when it prompt you for some reason. Lastly, you will be able to press "g" to generate.
  • At this stage, you should have either Xcode project or makefiles in build folder.
  • Xcode: open the project in the Xcode, go to the Project properties, change Base SDK to Current Mac OSX. Select glview as a target, run. :)
  • Make file: use "make all" to build the project. You will get the binary in some subfolders inside. You can run it by ./glview (for example)

Readings

Acknowledgement


TODO
Clean up this important note about libusb linking in framework
• change dylib id to the path you plan to put it
install_name_tool -id @loader_path/Libraries/libusb-i386.dylib libusb-i386.dylib

Here: @loader_path is referred to the path where binary resides. If you are embedding the library in the framework, @loader_path is the path of framework binary, e.g., "xxx.framework/Versions/A/". If you are embedding the libaray in the application, this will looks like "xxx.app/Content/MacOS"
• add the dylib to "Link Binary With Libraries" build phase
• add the dylib to a new "Copy Files" build phase. Configure the subdirectory to where inside the bundle you want to put dylib in.

Useful tools:
otool -L: for listing the linked library paths
install_name_tool: for modifying the id and paths referred to by a binary


References:

Attachments:
File Description File size Downloads Last modified
KinectTest.zip Xcode Project 141 kB 1913 2010-11-13 02:10
Kinect.mov video 11252 kB 2498 2010-11-13 10:13
101113 KinectTest.zip Xcode Project 142 kB 2162 2010-11-13 10:15
101114 KinectFramework.framework.zip Framework 48 kB 2176 2010-11-14 01:27
101114 KinectFWTest.zip Example Project 77 kB 2259 2010-11-14 01:28
101114 KinectTest with framework target.zip Source 145 kB 2170 2010-11-14 01:28
101114 KinectFramework.frameworki386.zip 32-bit 48 kB 2487 2010-11-14 13:38
101114 KinectFramework.frameworkx86_64.zip 64-bit 134 kB 2414 2010-11-14 13:38
101114 1332 KinectTest.zip Source 150 kB 2396 2010-11-14 13:42
101114 KinectFWTest.app.zip 64-bit App Bundle 163 kB 2724 2010-11-14 13:42
101114 1333 KinectFWTest.zip Source 165 kB 2121 2010-11-14 13:43

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.