├── wrappers ├── .gitignore ├── python │ ├── .gitignore │ ├── demo_cv_sync.py │ ├── demo_cv2_sync.py │ ├── demo_cv2_thresh_sweep.py │ ├── demo_cv_async.py │ ├── demo_cv2_async.py │ ├── demo_tilt.py │ ├── demo_cv_thresh_sweep.py │ ├── demo_mp_sync.py │ ├── demo_cv_sync_multi.py │ ├── demo_cv2_sync_multi.py │ ├── demo_mp_async.py │ ├── demo_cv2_threshold.py │ ├── frame_convert2.py │ ├── demo_cv_threshold.py │ ├── frame_convert.py │ └── setup.py ├── ruby │ └── ffi-libfreenect │ │ ├── VERSION │ │ ├── spec │ │ ├── spec.opts │ │ ├── spec_helper.rb │ │ ├── context_spec.rb │ │ └── freenect_spec.rb │ │ ├── History.txt │ │ ├── pkg │ │ └── ffi-libfreenect-0.1.1.gem │ │ ├── examples │ │ ├── tilt_nod.rb │ │ ├── video_snapshot.rb │ │ ├── record.rb │ │ └── tilt_led.rb │ │ ├── LICENSE.txt │ │ ├── lib │ │ ├── freenect.rb │ │ └── freenect │ │ │ ├── context.rb │ │ │ └── sync.rb │ │ ├── Rakefile │ │ └── README.rdoc ├── java │ ├── Makefile │ ├── .gitignore │ ├── README │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── openkinect │ │ │ └── freenect │ │ │ ├── LogHandler.java │ │ │ ├── DepthHandler.java │ │ │ ├── VideoHandler.java │ │ │ ├── Context.java │ │ │ ├── DeviceFlags.java │ │ │ ├── Resolution.java │ │ │ ├── TiltStatus.java │ │ │ ├── Device.java │ │ │ ├── LogLevel.java │ │ │ ├── DepthFormat.java │ │ │ ├── LedStatus.java │ │ │ ├── VideoFormat.java │ │ │ ├── util │ │ │ └── Jdk14LogHandler.java │ │ │ └── FrameMode.java │ └── pom.xml ├── csharp │ ├── src │ │ ├── test │ │ │ ├── KinectDemo │ │ │ │ ├── openkinect_icon.ico │ │ │ │ ├── openkinect_logo.png │ │ │ │ ├── VS2008 │ │ │ │ │ └── KinectDemo.sln │ │ │ │ ├── Program.cs │ │ │ │ ├── PreviewControl.UI.cs │ │ │ │ └── VS2010 │ │ │ │ │ └── KinectDemo.sln │ │ │ └── ConsoleTest │ │ │ │ ├── VS2008 │ │ │ │ ├── ConsoleTest.sln │ │ │ │ └── ConsoleTest.csproj │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ └── VS2010 │ │ │ │ └── ConsoleTest.sln │ │ └── lib │ │ │ ├── VS2008 │ │ │ └── freenectdotnet.sln │ │ │ ├── AssemblyInfo.cs │ │ │ ├── VS2010 │ │ │ └── freenectdotnet.sln │ │ │ ├── DepthMap.cs │ │ │ ├── ImageMap.cs │ │ │ ├── DepthFrameMode.cs │ │ │ ├── VideoFrameMode.cs │ │ │ ├── LogEventArgs.cs │ │ │ └── LED.cs │ ├── README │ └── support │ │ └── fetch_opentk.sh ├── opencv │ ├── libfreenect_cv.h │ ├── libfreenect_cv.cpp │ ├── CMakeLists.txt │ └── cvdemo.cpp ├── c_sync │ ├── README │ └── CMakeLists.txt ├── actionscript │ ├── org │ │ └── as3kinect │ │ │ ├── objects │ │ │ ├── PointWithID.as │ │ │ ├── as3kinectCalibrationParams.as │ │ │ └── motorData.as │ │ │ ├── events │ │ │ ├── as3kinectCalibrationEvent.as │ │ │ ├── as3kinectSocketEvent.as │ │ │ └── as3kinectWrapperEvent.as │ │ │ └── as3kinectWrapperEvent.as │ ├── CMakeLists.txt │ └── server │ │ ├── as3_jpeg.h │ │ ├── freenect_network.h │ │ └── as3_jpeg.c └── cpp │ └── CMakeLists.txt ├── .gitattributes ├── platform ├── linux │ └── udev │ │ ├── README │ │ └── 51-kinect.rules └── windows │ ├── inf │ ├── xbox nui audio │ │ ├── ia64 │ │ │ ├── libusb0.dll │ │ │ └── libusb0.sys │ │ ├── x86 │ │ │ ├── libusb0.sys │ │ │ └── libusb0_x86.dll │ │ ├── Xbox_NUI_Audio.cat │ │ ├── Xbox_NUI_Audio.inf │ │ ├── amd64 │ │ │ ├── libusb0.dll │ │ │ └── libusb0.sys │ │ └── libusb-win32-bin-README.txt │ ├── xbox nui camera │ │ ├── x86 │ │ │ ├── libusb0.sys │ │ │ └── libusb0_x86.dll │ │ ├── amd64 │ │ │ ├── libusb0.dll │ │ │ └── libusb0.sys │ │ ├── ia64 │ │ │ ├── libusb0.dll │ │ │ └── libusb0.sys │ │ ├── Xbox_NUI_Camera.cat │ │ ├── Xbox_NUI_Camera.inf │ │ └── libusb-win32-bin-README.txt │ └── xbox nui motor │ │ ├── ia64 │ │ ├── libusb0.dll │ │ └── libusb0.sys │ │ ├── x86 │ │ ├── libusb0.sys │ │ └── libusb0_x86.dll │ │ ├── Xbox_NUI_Motor.cat │ │ ├── Xbox_NUI_Motor.inf │ │ ├── amd64 │ │ ├── libusb0.dll │ │ └── libusb0.sys │ │ └── libusb-win32-bin-README.txt │ ├── libusb10emu │ └── libusb-1.0 │ │ ├── failguard.h │ │ ├── failguard.cpp │ │ └── libusbemu_threads.h │ └── unistd.h ├── src ├── libfreenect.pc.in ├── cameras.h ├── registration.h ├── flags.h ├── CMakeLists.txt └── loader.h ├── mkcontrib.sh ├── libfreenectConfig.cmake.in ├── doc ├── astyle.conf └── DoxygenMainpage.h ├── .gitignore ├── fakenect ├── fakenect.1 ├── CMakeLists.txt ├── fakenect-record.1 ├── fakenect.sh.in └── platform.h ├── CONTRIB ├── cmake_modules ├── SetupDirectories.cmake ├── UninstallTarget.cmake.in └── FindOS.cmake ├── OpenNI2-FreenectDriver ├── CMakeLists.txt ├── extern │ └── OpenNI-Linux-x64-2.2.0.33 │ │ └── Include │ │ ├── Linux-Arm │ │ └── OniPlatformLinux-Arm.h │ │ ├── MacOSX │ │ └── OniPlatformMacOSX.h │ │ ├── Android-Arm │ │ └── OniPlatformAndroid-Arm.h │ │ ├── OniVersion.h │ │ ├── Driver │ │ └── OniDriverTypes.h │ │ ├── OniEnums.h │ │ ├── OniCEnums.h │ │ ├── OniProperties.h │ │ └── OniCProperties.h ├── src │ ├── Utility.hpp │ └── ColorStream.cpp └── README.md └── examples └── CMakeLists.txt /wrappers/.gitignore: -------------------------------------------------------------------------------- 1 | /test/ 2 | -------------------------------------------------------------------------------- /wrappers/python/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/VERSION: -------------------------------------------------------------------------------- 1 | 0.1.1 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | wrappers/python/freenect.c binary 2 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/spec/spec.opts: -------------------------------------------------------------------------------- 1 | --format specdoc 2 | --color 3 | -------------------------------------------------------------------------------- /wrappers/java/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | mvn assembly:assembly -Dmaven.test.skip=true 3 | -------------------------------------------------------------------------------- /platform/linux/udev/README: -------------------------------------------------------------------------------- 1 | Simply place this file in /etc/udev/rules.d and you'll no longer need 2 | to run your apps as root. 3 | -------------------------------------------------------------------------------- /wrappers/java/.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings/ 4 | target/ 5 | /freenect.iml 6 | /freenect.ipr 7 | /freenect.iws 8 | -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/ia64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/ia64/libusb0.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/ia64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/ia64/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/x86/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/x86/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/x86/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/x86/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/ia64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/ia64/libusb0.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/ia64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/ia64/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/x86/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/x86/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/Xbox_NUI_Audio.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/Xbox_NUI_Audio.cat -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/Xbox_NUI_Audio.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/Xbox_NUI_Audio.inf -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/amd64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/amd64/libusb0.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/amd64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/amd64/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/x86/libusb0_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui audio/x86/libusb0_x86.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/amd64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/amd64/libusb0.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/amd64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/amd64/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/ia64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/ia64/libusb0.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/ia64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/ia64/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/Xbox_NUI_Motor.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/Xbox_NUI_Motor.cat -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/Xbox_NUI_Motor.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/Xbox_NUI_Motor.inf -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/amd64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/amd64/libusb0.dll -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/amd64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/amd64/libusb0.sys -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/x86/libusb0_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui motor/x86/libusb0_x86.dll -------------------------------------------------------------------------------- /wrappers/csharp/src/test/KinectDemo/openkinect_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/wrappers/csharp/src/test/KinectDemo/openkinect_icon.ico -------------------------------------------------------------------------------- /wrappers/csharp/src/test/KinectDemo/openkinect_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/wrappers/csharp/src/test/KinectDemo/openkinect_logo.png -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/History.txt: -------------------------------------------------------------------------------- 1 | == 0.1.1 / 2010-12-22 2 | * Initial release version 3 | 4 | == 0.1.0 / 2010-12-13 5 | * Initial packaged version 6 | -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/Xbox_NUI_Camera.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/Xbox_NUI_Camera.cat -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/Xbox_NUI_Camera.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/Xbox_NUI_Camera.inf -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/x86/libusb0_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/platform/windows/inf/xbox nui camera/x86/libusb0_x86.dll -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/pkg/ffi-libfreenect-0.1.1.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samyk/libfreenect/HEAD/wrappers/ruby/ffi-libfreenect/pkg/ffi-libfreenect-0.1.1.gem -------------------------------------------------------------------------------- /platform/windows/libusb10emu/libusb-1.0/failguard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace libusbemu 4 | { 5 | namespace failguard 6 | { 7 | const bool Check(); 8 | 9 | void WaitDecision(); 10 | 11 | const bool Abort(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /wrappers/opencv/libfreenect_cv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | IplImage *freenect_sync_get_depth_cv(int index); 10 | IplImage *freenect_sync_get_rgb_cv(int index); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | SPEC_DIR = File.expand_path(File.dirname(__FILE__)) 2 | 3 | $LOAD_PATH.unshift(SPEC_DIR) 4 | $LOAD_PATH.unshift(File.join(SPEC_DIR, '..', 'lib')) 5 | 6 | require 'freenect' 7 | # require 'rspec' 8 | require 'rspec/core' 9 | 10 | RSpec.configure do |config| 11 | end 12 | -------------------------------------------------------------------------------- /wrappers/csharp/README: -------------------------------------------------------------------------------- 1 | 2 | 3 | Just a quick readme for now... will flesh out at some point. 4 | 5 | Need monodevelop (or the mono compiler) for now. Will provide VS stuff later 6 | on. 7 | 8 | -Compiled stuff from goes to bin folder under the folder this file is in. 9 | -Copy over libfreenect.so into bin. 10 | -Run! 11 | -------------------------------------------------------------------------------- /src/libfreenect.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/@PROJECT_LIBRARY_INSTALL_DIR@ 4 | includedir=${prefix}/@PROJECT_INCLUDE_INSTALL_DIR@ 5 | 6 | Name: @CMAKE_PROJECT_NAME@ 7 | Description: Interface to the Microsoft Kinect sensor device. 8 | Requires.private: libusb-1.0 9 | Version: @PROJECT_APIVER@ 10 | Libs: -L${libdir} -lfreenect 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /mkcontrib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "The following people have contributed to libfreenect:" > CONTRIB 4 | echo >> CONTRIB 5 | 6 | # note: some exclusions to clean up botched git author tags that got fixed in 7 | # later commits, hopefully we'll be more careful about this in the future 8 | git log --format='%aN <%aE>' | sort | uniq | grep -E -v \ 9 | 'brandyn@router|sl203|mwise@bvo|richmattes|kai.*none' | sort >> CONTRIB 10 | -------------------------------------------------------------------------------- /wrappers/c_sync/README: -------------------------------------------------------------------------------- 1 | ** Freenect C Synchronous Interface ** 2 | - Brandyn White (bwhite@dappervision.com) 3 | - Andrew Miller (amiller@dappervision.com) 4 | 5 | Provides a synchronous interface (e.g., freenect_get_depth and freenect_get_rgb) as opposed to callbacks. Uses pthreads. The Cython Syncrhonous interfaces uses these, that is the simplest way to test this. 6 | 7 | See http://openkinect.org/wiki/C_Sync_Wrapper for up-to-date info -------------------------------------------------------------------------------- /libfreenectConfig.cmake.in: -------------------------------------------------------------------------------- 1 | get_filename_component(CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 2 | 3 | set(FREENECT_INCLUDE_DIRS "${CONFIG_DIR}/../../@PROJECT_INCLUDE_INSTALL_DIR@") 4 | set(FREENECT_RUNTIME_LIBRARY_DIRS "${CONFIG_DIR}/../../bin") 5 | set(FREENECT_LIBRARY_DIRS "${CONFIG_DIR}/../../@PROJECT_LIBRARY_INSTALL_DIR@") 6 | #/libfreenect.so.@PROJECT_VER@ 7 | set(FREENECT_LIBRARIES "freenect") 8 | set(FREENECT_VERSION "@PROJECT_VER@") 9 | -------------------------------------------------------------------------------- /wrappers/csharp/support/fetch_opentk.sh: -------------------------------------------------------------------------------- 1 | wget http://sourceforge.net/projects/opentk/files/opentk/opentk-1.0/2010-10-06/opentk-2010-10-06.zip/download -Odownload.zip 2 | unzip download.zip 3 | rm -rf download 4 | cp opentk/Binaries/OpenTK/Release/OpenTK.dll . 5 | cp opentk/Binaries/OpenTK/Release/OpenTK.GLControl.dll . 6 | echo "" 7 | echo "-------------------------------------------" 8 | echo "All done! Good to go!" 9 | echo "" 10 | echo "" 11 | -------------------------------------------------------------------------------- /doc/astyle.conf: -------------------------------------------------------------------------------- 1 | # astyle config for the OpenKinect project 2 | # 3 | # To use: 4 | # astyle --options=astyle.conf -r ../src/*.c 5 | # 6 | # Due to limitations, this should not be used on header files 7 | # because it will indent all function declarations inside extern 8 | # blocks. - http://bit.ly/fG5piu 9 | indent=tab=4 10 | min-conditional-indent=0 11 | brackets=linux 12 | indent-switches 13 | unpad-paren 14 | pad-header 15 | lineend=linux 16 | suffix=none 17 | -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/objects/PointWithID.as: -------------------------------------------------------------------------------- 1 | package org.as3kinect.objects { 2 | import flash.geom.Point; 3 | 4 | /** 5 | * @author stevie 6 | * @date 24.06.2011 7 | */ 8 | public class PointWithID extends Point { 9 | public var id:int; 10 | public var inUse:Boolean; 11 | public function PointWithID(x : Number = 0, y : Number = 0) { 12 | super(x, y); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #ignore thumbnails created by windows 2 | Thumbs.db 3 | #ignore Desktop Service Store files created by mac 4 | *.DS_Store 5 | #Ignore files build by Visual Studio 6 | *.obj 7 | *.exe 8 | *.pdb 9 | *.user 10 | *.aps 11 | *.pch 12 | *.vspscc 13 | *_i.c 14 | *_p.c 15 | *.ncb 16 | *.suo 17 | *.tlb 18 | *.tlh 19 | *.bak 20 | *.cache 21 | *.ilk 22 | *.log 23 | [Bb]in 24 | [Dd]ebug*/ 25 | *.lib 26 | *.sbr 27 | obj/ 28 | [Rr]elease*/ 29 | _ReSharper*/ 30 | [Tt]est[Rr]esult* 31 | build 32 | /results/ 33 | -------------------------------------------------------------------------------- /fakenect/fakenect.1: -------------------------------------------------------------------------------- 1 | .TH FAKENECT 1 2012-01-29 "libfreenect" "libfreenect manual" 2 | .SH NAME 3 | fakenect - Run a program by faking the Kinect 4 | .SH SYNOPSIS 5 | .SY fakenect 6 | .I database 7 | .I application 8 | .I args 9 | .br 10 | .SH DESCRIPTION 11 | .LP 12 | \fBfakenect\fP runs \fIapplication\fP with the arguments \fIargs\fP using 13 | the data contained in the folder \fIdatabase\fP. These data should have been 14 | recorded using \fIfakenect-record\fP(1). 15 | .SH "SEE ALSO" 16 | .BR fakenect-record (1) 17 | 18 | 19 | -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/events/as3kinectCalibrationEvent.as: -------------------------------------------------------------------------------- 1 | package org.as3kinect.events 2 | { 3 | import flash.events.Event; 4 | 5 | public class as3kinectCalibrationEvent extends Event 6 | { 7 | 8 | public static const CALIBRATION_STEP_ONE:String = "CALIBRATION_FIRST_STEP_as3kinectCalibrationEvent"; 9 | public static const CALIBRATION_COMPLETE:String = "CALIBRATION_COMPLETE_as3kinectCalibrationEvent"; 10 | 11 | public function as3kinectCalibrationEvent(type : String) 12 | { 13 | super(type); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /wrappers/python/demo_cv_sync.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import cv 4 | import frame_convert 5 | 6 | cv.NamedWindow('Depth') 7 | cv.NamedWindow('Video') 8 | print('Press ESC in window to stop') 9 | 10 | 11 | def get_depth(): 12 | return frame_convert.pretty_depth_cv(freenect.sync_get_depth()[0]) 13 | 14 | 15 | def get_video(): 16 | return frame_convert.video_cv(freenect.sync_get_video()[0]) 17 | 18 | 19 | while 1: 20 | cv.ShowImage('Depth', get_depth()) 21 | cv.ShowImage('Video', get_video()) 22 | if cv.WaitKey(10) == 27: 23 | break 24 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv2_sync.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import cv2 4 | import frame_convert2 5 | 6 | cv2.namedWindow('Depth') 7 | cv2.namedWindow('Video') 8 | print('Press ESC in window to stop') 9 | 10 | 11 | def get_depth(): 12 | return frame_convert2.pretty_depth_cv(freenect.sync_get_depth()[0]) 13 | 14 | 15 | def get_video(): 16 | return frame_convert2.video_cv(freenect.sync_get_video()[0]) 17 | 18 | 19 | while 1: 20 | cv2.imshow('Depth', get_depth()) 21 | cv2.imshow('Video', get_video()) 22 | if cv2.waitKey(10) == 27: 23 | break 24 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/examples/tilt_nod.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # 3 | 4 | $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib")) 5 | 6 | require 'freenect' 7 | 8 | ctx = Freenect.init 9 | unless ctx.num_devices() > 0 10 | STDERR.puts "No kinect device detected" 11 | exit 1 12 | end 13 | 14 | dev = ctx[0] 15 | dev.set_led(:blink_red_yellow) 16 | 17 | 3.times do 18 | dev.set_tilt_degrees(15) 19 | sleep 2 20 | dev.set_tilt_degrees(-15) 21 | sleep 2 22 | end 23 | dev.set_tilt_degrees(0.0) 24 | 25 | dev.set_led(:off) 26 | dev.close 27 | ctx.shutdown 28 | 29 | -------------------------------------------------------------------------------- /CONTRIB: -------------------------------------------------------------------------------- 1 | For a list of libfreenect authors, please see the Git history of the project, 2 | such as with 'git log'. This file will contain a list of authors on release 3 | snapshots of libfreenect. 4 | 5 | THIS FILE IS NOT VALID FOR NON-GIT DISTRIBUTIONS. If you wish to redistribute 6 | libfreenect source code outside of the Git infrastructure, you MUST either use 7 | a release version or generate a complete CONTRIB file valid for the source Git 8 | revision tree that you use for your distribution. Redistributions of libfreenect 9 | source code without a valid CONTRIB file and without Git metadata are not 10 | compliant with the license. 11 | -------------------------------------------------------------------------------- /platform/linux/udev/51-kinect.rules: -------------------------------------------------------------------------------- 1 | # ATTR{product}=="Xbox NUI Motor" 2 | SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02b0", MODE="0666" 3 | # ATTR{product}=="Xbox NUI Audio" 4 | SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ad", MODE="0666" 5 | # ATTR{product}=="Xbox NUI Camera" 6 | SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ae", MODE="0666" 7 | 8 | # Kinect for Windows 9 | SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02c2", MODE="0666" 10 | SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02be", MODE="0666" 11 | SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02bf", MODE="0666" 12 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv2_thresh_sweep.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Sweeps throught the depth image showing 100 range at a time""" 3 | import freenect 4 | import cv2 5 | import numpy as np 6 | import time 7 | 8 | cv2.namedWindow('Depth') 9 | 10 | 11 | def disp_thresh(lower, upper): 12 | depth, timestamp = freenect.sync_get_depth() 13 | depth = 255 * np.logical_and(depth > lower, depth < upper) 14 | depth = depth.astype(np.uint8) 15 | cv2.imshow('Depth', depth) 16 | cv2.waitKey(10) 17 | 18 | 19 | lower = 0 20 | upper = 100 21 | max_upper = 2048 22 | while upper < max_upper: 23 | print('%d < depth < %d' % (lower, upper)) 24 | disp_thresh(lower, upper) 25 | time.sleep(.1) 26 | lower += 20 27 | upper += 20 28 | -------------------------------------------------------------------------------- /cmake_modules/SetupDirectories.cmake: -------------------------------------------------------------------------------- 1 | # Default installation directory, based on operating system 2 | IF (PROJECT_OS_WIN) 3 | SET (CMAKE_INSTALL_PREFIX "C:\\Program Files\\libfreenect" CACHE PATH "Installation directory") 4 | ELSE (PROJECT_OS_WIN) 5 | SET (CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation directory") 6 | ENDIF (PROJECT_OS_WIN) 7 | 8 | STRING (TOLOWER ${PROJECT_NAME} projectNameLower) 9 | SET (PROJECT_INCLUDE_INSTALL_DIR "include/${projectNameLower}") 10 | SET (PROJECT_MANPAGE_INSTALL_DIR "share/man") 11 | SET (PROJECT_LIBRARY_INSTALL_DIR "lib") 12 | 13 | MESSAGE (STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}") 14 | MESSAGE (STATUS "Headers will be installed to ${CMAKE_INSTALL_PREFIX}/${PROJECT_INCLUDE_INSTALL_DIR}") 15 | MESSAGE (STATUS "Libraries will be installed to ${CMAKE_INSTALL_PREFIX}/${PROJECT_LIBRARY_INSTALL_DIR}") 16 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv_async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import cv 4 | import frame_convert 5 | 6 | cv.NamedWindow('Depth') 7 | cv.NamedWindow('RGB') 8 | keep_running = True 9 | 10 | 11 | def display_depth(dev, data, timestamp): 12 | global keep_running 13 | cv.ShowImage('Depth', frame_convert.pretty_depth_cv(data)) 14 | if cv.WaitKey(10) == 27: 15 | keep_running = False 16 | 17 | 18 | def display_rgb(dev, data, timestamp): 19 | global keep_running 20 | cv.ShowImage('RGB', frame_convert.video_cv(data)) 21 | if cv.WaitKey(10) == 27: 22 | keep_running = False 23 | 24 | 25 | def body(*args): 26 | if not keep_running: 27 | raise freenect.Kill 28 | 29 | 30 | print('Press ESC in window to stop') 31 | freenect.runloop(depth=display_depth, 32 | video=display_rgb, 33 | body=body) 34 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv2_async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import cv2 4 | import frame_convert2 5 | 6 | cv2.namedWindow('Depth') 7 | cv2.namedWindow('RGB') 8 | keep_running = True 9 | 10 | 11 | def display_depth(dev, data, timestamp): 12 | global keep_running 13 | cv2.imshow('Depth', frame_convert2.pretty_depth_cv(data)) 14 | if cv2.waitKey(10) == 27: 15 | keep_running = False 16 | 17 | 18 | def display_rgb(dev, data, timestamp): 19 | global keep_running 20 | cv2.imshow('RGB', frame_convert2.video_cv(data)) 21 | if cv2.waitKey(10) == 27: 22 | keep_running = False 23 | 24 | 25 | def body(*args): 26 | if not keep_running: 27 | raise freenect.Kill 28 | 29 | 30 | print('Press ESC in window to stop') 31 | freenect.runloop(depth=display_depth, 32 | video=display_rgb, 33 | body=body) 34 | -------------------------------------------------------------------------------- /wrappers/python/demo_tilt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import time 4 | import random 5 | import signal 6 | 7 | keep_running = True 8 | last_time = 0 9 | 10 | 11 | def body(dev, ctx): 12 | global last_time 13 | if not keep_running: 14 | raise freenect.Kill 15 | if time.time() - last_time < 3: 16 | return 17 | last_time = time.time() 18 | led = random.randint(0, 6) 19 | tilt = random.randint(0, 30) 20 | freenect.set_led(dev, led) 21 | freenect.set_tilt_degs(dev, tilt) 22 | print('led[%d] tilt[%d] accel[%s]' % (led, tilt, freenect.get_accel(dev))) 23 | 24 | 25 | def handler(signum, frame): 26 | """Sets up the kill handler, catches SIGINT""" 27 | global keep_running 28 | keep_running = False 29 | print('Press Ctrl-C in terminal to stop') 30 | signal.signal(signal.SIGINT, handler) 31 | freenect.runloop(body=body) 32 | -------------------------------------------------------------------------------- /wrappers/opencv/libfreenect_cv.cpp: -------------------------------------------------------------------------------- 1 | #include "libfreenect.h" 2 | #include "libfreenect_sync.h" 3 | #include "libfreenect_cv.h" 4 | 5 | IplImage *freenect_sync_get_depth_cv(int index) 6 | { 7 | static IplImage *image = 0; 8 | static char *data = 0; 9 | if (!image) image = cvCreateImageHeader(cvSize(640,480), 16, 1); 10 | unsigned int timestamp; 11 | if (freenect_sync_get_depth((void**)&data, ×tamp, index, FREENECT_DEPTH_11BIT)) 12 | return NULL; 13 | cvSetData(image, data, 640*2); 14 | return image; 15 | } 16 | 17 | IplImage *freenect_sync_get_rgb_cv(int index) 18 | { 19 | static IplImage *image = 0; 20 | static char *data = 0; 21 | if (!image) image = cvCreateImageHeader(cvSize(640,480), 8, 3); 22 | unsigned int timestamp; 23 | if (freenect_sync_get_video((void**)&data, ×tamp, index, FREENECT_VIDEO_RGB)) 24 | return NULL; 25 | cvSetData(image, data, 640*3); 26 | return image; 27 | } 28 | -------------------------------------------------------------------------------- /wrappers/opencv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # OpenCV Interface 3 | ###################################################################################### 4 | find_package(OpenCV REQUIRED) 5 | add_library (freenect_cv SHARED libfreenect_cv.cpp) 6 | set_target_properties (freenect_cv PROPERTIES 7 | VERSION ${PROJECT_VER} 8 | SOVERSION ${PROJECT_APIVER}) 9 | 10 | include_directories (../c_sync) 11 | 12 | target_link_libraries (freenect_cv freenect_sync ${OpenCV_LIBS}) 13 | 14 | install (TARGETS freenect_cv 15 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}") 16 | install (FILES "libfreenect_cv.h" 17 | DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}) 18 | 19 | add_executable(freenect-cvdemo cvdemo.cpp) 20 | target_link_libraries(freenect-cvdemo freenect freenect_sync freenect_cv ${OpenCV_LIBS}) 21 | install (TARGETS freenect-cvdemo 22 | DESTINATION bin) 23 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/KinectDemo/VS2008/KinectDemo.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KinectDemo", "KinectDemo.csproj", "{2EBB5F0B-9C65-4777-8B0C-76A83867C650}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|x86.ActiveCfg = Debug|x86 13 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|x86.Build.0 = Debug|x86 14 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|x86.ActiveCfg = Release|x86 15 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(MonoDevelopProperties) = preSolution 18 | StartupItem = KinectDemo.csproj 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/ConsoleTest/VS2008/ConsoleTest.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "ConsoleTest.csproj", "{D5CAFFD9-EC8B-4A16-80C9-48048C85843A}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|x86.ActiveCfg = Debug|x86 13 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|x86.Build.0 = Debug|x86 14 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|x86.ActiveCfg = Release|x86 15 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(MonoDevelopProperties) = preSolution 18 | StartupItem = ConsoleTest.csproj 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv_thresh_sweep.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Sweeps throught the depth image showing 100 range at a time""" 3 | import freenect 4 | import cv 5 | import numpy as np 6 | import time 7 | 8 | cv.NamedWindow('Depth') 9 | 10 | 11 | def disp_thresh(lower, upper): 12 | depth, timestamp = freenect.sync_get_depth() 13 | depth = 255 * np.logical_and(depth > lower, depth < upper) 14 | depth = depth.astype(np.uint8) 15 | image = cv.CreateImageHeader((depth.shape[1], depth.shape[0]), 16 | cv.IPL_DEPTH_8U, 17 | 1) 18 | cv.SetData(image, depth.tostring(), 19 | depth.dtype.itemsize * depth.shape[1]) 20 | cv.ShowImage('Depth', image) 21 | cv.WaitKey(10) 22 | 23 | 24 | lower = 0 25 | upper = 100 26 | max_upper = 2048 27 | while upper < max_upper: 28 | print('%d < depth < %d' % (lower, upper)) 29 | disp_thresh(lower, upper) 30 | time.sleep(.1) 31 | lower += 20 32 | upper += 20 33 | -------------------------------------------------------------------------------- /wrappers/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1.0) 2 | set_property(DIRECTORY PROPERTY CXX_STANDARD 11) 3 | 4 | install(FILES libfreenect.hpp 5 | DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}) 6 | 7 | if (BUILD_EXAMPLES) 8 | set(THREADS_USE_PTHREADS_WIN32 true) 9 | find_package(Threads) 10 | find_package(OpenGL) 11 | find_package(GLUT) 12 | 13 | if (Threads_FOUND AND OPENGL_FOUND AND GLUT_FOUND) 14 | include_directories(. ${THREADS_PTHREADS_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}) 15 | 16 | add_executable(freenect-cppview cppview.cpp) 17 | add_executable(freenect-cpp_pcview cpp_pc_view.cpp) 18 | 19 | target_link_libraries(freenect-cppview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 20 | target_link_libraries(freenect-cpp_pcview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 21 | 22 | install(TARGETS freenect-cppview freenect-cpp_pcview 23 | DESTINATION bin) 24 | endif() 25 | endif() 26 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/VS2008/freenectdotnet.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "freenectdotnet", "freenectdotnet.csproj", "{360413F9-4D9B-46BE-BEC7-9B666850ED8C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(MonoDevelopProperties) = preSolution 18 | StartupItem = freenectdotnet.csproj 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /wrappers/python/demo_mp_sync.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import matplotlib.pyplot as mp 4 | import frame_convert 5 | import signal 6 | 7 | keep_running = True 8 | 9 | 10 | def get_depth(): 11 | return frame_convert.pretty_depth(freenect.sync_get_depth()[0]) 12 | 13 | 14 | def get_video(): 15 | return freenect.sync_get_video()[0] 16 | 17 | 18 | def handler(signum, frame): 19 | """Sets up the kill handler, catches SIGINT""" 20 | global keep_running 21 | keep_running = False 22 | 23 | 24 | mp.ion() 25 | mp.gray() 26 | mp.figure(1) 27 | image_depth = mp.imshow(get_depth(), interpolation='nearest', animated=True) 28 | mp.figure(2) 29 | image_rgb = mp.imshow(get_video(), interpolation='nearest', animated=True) 30 | print('Press Ctrl-C in terminal to stop') 31 | signal.signal(signal.SIGINT, handler) 32 | 33 | while keep_running: 34 | mp.figure(1) 35 | image_depth.set_data(get_depth()) 36 | mp.figure(2) 37 | image_rgb.set_data(get_video()) 38 | mp.draw() 39 | mp.waitforbuttonpress(0.01) 40 | -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui audio/libusb-win32-bin-README.txt: -------------------------------------------------------------------------------- 1 | libusb-win32-bin v1.2.2.0 (10/02/2010) - [Package Information] 2 | 3 | ALL ARCHITECTURES: 4 | x86\libusb0_x86.dll: x86 32-bit library. Must be renamed to libusb0.dll 5 | On 64 bit, Installs to Windows\syswow64\libusb0.dll. 6 | On 32 bit, Installs to Windows\system32\libusb0.dll. 7 | 8 | x86\inf-wizard.exe: inf-wizard application with embedded libusb-win32 9 | v1.2.2.0 binaries. 10 | 11 | X86 ONLY ARCHITECTURES: 12 | x86\libusb0.sys: x86 32-bit driver. 13 | Installs to Windows\system32\drivers\libusb0.sys 14 | 15 | AMD64-INTEL64 ONLY ARCHITECTURES: 16 | amd64\libusb0.sys: x64 64-bit driver. 17 | Installs to Windows\system32\drivers\libusb0.sys 18 | 19 | amd64\libusb0.dll: x64 64-bit library. 20 | Installs to Windows\system32\libusb0.dll 21 | 22 | IA64 ONLY ARCHITECTURES: 23 | ia64\libusb0.sys: IA64 64-bit driver. 24 | Installs to Windows\system32\drivers\libusb0.sys 25 | 26 | ia64\libusb0.dll: IA64 64-bit library. 27 | Installs to Windows\system32\libusb0.dll 28 | -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui motor/libusb-win32-bin-README.txt: -------------------------------------------------------------------------------- 1 | libusb-win32-bin v1.2.2.0 (10/02/2010) - [Package Information] 2 | 3 | ALL ARCHITECTURES: 4 | x86\libusb0_x86.dll: x86 32-bit library. Must be renamed to libusb0.dll 5 | On 64 bit, Installs to Windows\syswow64\libusb0.dll. 6 | On 32 bit, Installs to Windows\system32\libusb0.dll. 7 | 8 | x86\inf-wizard.exe: inf-wizard application with embedded libusb-win32 9 | v1.2.2.0 binaries. 10 | 11 | X86 ONLY ARCHITECTURES: 12 | x86\libusb0.sys: x86 32-bit driver. 13 | Installs to Windows\system32\drivers\libusb0.sys 14 | 15 | AMD64-INTEL64 ONLY ARCHITECTURES: 16 | amd64\libusb0.sys: x64 64-bit driver. 17 | Installs to Windows\system32\drivers\libusb0.sys 18 | 19 | amd64\libusb0.dll: x64 64-bit library. 20 | Installs to Windows\system32\libusb0.dll 21 | 22 | IA64 ONLY ARCHITECTURES: 23 | ia64\libusb0.sys: IA64 64-bit driver. 24 | Installs to Windows\system32\drivers\libusb0.sys 25 | 26 | ia64\libusb0.dll: IA64 64-bit library. 27 | Installs to Windows\system32\libusb0.dll 28 | -------------------------------------------------------------------------------- /platform/windows/inf/xbox nui camera/libusb-win32-bin-README.txt: -------------------------------------------------------------------------------- 1 | libusb-win32-bin v1.2.2.0 (10/02/2010) - [Package Information] 2 | 3 | ALL ARCHITECTURES: 4 | x86\libusb0_x86.dll: x86 32-bit library. Must be renamed to libusb0.dll 5 | On 64 bit, Installs to Windows\syswow64\libusb0.dll. 6 | On 32 bit, Installs to Windows\system32\libusb0.dll. 7 | 8 | x86\inf-wizard.exe: inf-wizard application with embedded libusb-win32 9 | v1.2.2.0 binaries. 10 | 11 | X86 ONLY ARCHITECTURES: 12 | x86\libusb0.sys: x86 32-bit driver. 13 | Installs to Windows\system32\drivers\libusb0.sys 14 | 15 | AMD64-INTEL64 ONLY ARCHITECTURES: 16 | amd64\libusb0.sys: x64 64-bit driver. 17 | Installs to Windows\system32\drivers\libusb0.sys 18 | 19 | amd64\libusb0.dll: x64 64-bit library. 20 | Installs to Windows\system32\libusb0.dll 21 | 22 | IA64 ONLY ARCHITECTURES: 23 | ia64\libusb0.sys: IA64 64-bit driver. 24 | Installs to Windows\system32\drivers\libusb0.sys 25 | 26 | ia64\libusb0.dll: IA64 64-bit library. 27 | Installs to Windows\system32\libusb0.dll 28 | -------------------------------------------------------------------------------- /cmake_modules/UninstallTarget.cmake.in: -------------------------------------------------------------------------------- 1 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach (file ${files}) 8 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 9 | if (EXISTS "$ENV{DESTDIR}${file}") 10 | execute_process( 11 | COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" 12 | OUTPUT_VARIABLE rm_out 13 | RESULT_VARIABLE rm_retval 14 | ) 15 | if(NOT ${rm_retval} EQUAL 0) 16 | message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif (NOT ${rm_retval} EQUAL 0) 18 | else (EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 20 | endif (EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("freenectdotnet")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("freenect")] 12 | [assembly: AssemblyCopyright("")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/ConsoleTest/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("ConsoleTest")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.0.*")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | 28 | -------------------------------------------------------------------------------- /wrappers/c_sync/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # C Synchronous Interface 3 | ###################################################################################### 4 | 5 | set(THREADS_USE_PTHREADS_WIN32 true) 6 | find_package(Threads REQUIRED) 7 | include_directories(${THREADS_PTHREADS_INCLUDE_DIR}) 8 | 9 | add_library (freenect_sync SHARED libfreenect_sync.c) 10 | add_library (freenect_sync_static STATIC libfreenect_sync.c) 11 | set_target_properties (freenect_sync_static PROPERTIES OUTPUT_NAME freenect_sync) 12 | 13 | set_target_properties (freenect_sync PROPERTIES 14 | VERSION ${PROJECT_VER} 15 | SOVERSION ${PROJECT_APIVER}) 16 | 17 | target_link_libraries (freenect_sync freenect ${CMAKE_THREAD_LIBS_INIT}) 18 | target_link_libraries (freenect_sync_static freenect ${CMAKE_THREAD_LIBS_INIT}) 19 | 20 | install (TARGETS freenect_sync 21 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}") 22 | install (TARGETS freenect_sync_static 23 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}") 24 | install (FILES "libfreenect_sync.h" 25 | DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}) 26 | -------------------------------------------------------------------------------- /wrappers/java/README: -------------------------------------------------------------------------------- 1 | libfreenect for Java 2 | ==================== 3 | 4 | This is an API decided to be familiar to most Java developers. Where 5 | possible, the native library details have been hidden from view. 6 | 7 | The entry point into the API is the Freenect.createContext() static 8 | factory method. This will initialize and return a Context which you 9 | can then use to query for and interact with supported devices, like 10 | the Microsoft Kinect. The the Javadoc for further details. 11 | 12 | Building the library 13 | ==================== 14 | 15 | This project is built with Maven and uses the standard maven build 16 | phases. See http://maven.apache.org/ for more details. 17 | 18 | Quick start for Ubuntu: 19 | 20 | sudo apt-get install maven2 21 | mvn package 22 | 23 | Using the library 24 | ================= 25 | 26 | The library requires a platform installed shared library of libfreenect 27 | to be present in a standard location on the system. This is typically 28 | /usr/lib or /usr/local/lib on unix-like platforms. dYou may also be able 29 | to place the library in current directory to be loaded, but this is not 30 | recommended. 31 | -------------------------------------------------------------------------------- /wrappers/actionscript/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # ActionScript socket server builder 3 | ###################################################################################### 4 | 5 | find_package(JPEG REQUIRED) 6 | 7 | include_directories(${JPEG_INCLUDE_DIR}) 8 | 9 | add_library (as3_jpeg server/as3_jpeg.c) 10 | target_link_libraries (as3_jpeg ${JPEG_LIBRARIES}) 11 | 12 | add_library (freenect_network server/freenect_network.c) 13 | 14 | if (WIN32) 15 | set_source_files_properties(server/as3-server.c PROPERTIES LANGUAGE CXX) 16 | 17 | set(THREADS_USE_PTHREADS_WIN32 true) 18 | find_package(Threads REQUIRED) 19 | 20 | include_directories(${THREADS_PTHREADS_INCLUDE_DIR}) 21 | endif() 22 | 23 | add_executable(as3-server server/as3-server.c) 24 | if(APPLE) 25 | set(CMAKE_EXE_LINKER_FLAGS "-framework CoreFoundation -framework IOKit") 26 | else(APPLE) 27 | find_package(Threads REQUIRED) 28 | endif() 29 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../wrappers/c_sync) 30 | 31 | target_link_libraries(as3-server freenect_sync_static as3_jpeg freenect_network ${MATH_LIB} ${CMAKE_THREAD_LIBS_INIT}) 32 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv_sync_multi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """This goes through each kinect on your system, grabs one frame and 3 | displays it. Uncomment the commented line to shut down after each frame 4 | if your system can't handle it (will get very low FPS but it should work). 5 | This will keep trying indeces until it finds one that doesn't work, then it 6 | starts from 0. 7 | """ 8 | import freenect 9 | import cv 10 | import frame_convert 11 | 12 | cv.NamedWindow('Depth') 13 | cv.NamedWindow('Video') 14 | ind = 0 15 | print('%s\nPress ESC to stop' % __doc__) 16 | 17 | 18 | def get_depth(ind): 19 | return frame_convert.pretty_depth_cv(freenect.sync_get_depth(ind)[0]) 20 | 21 | 22 | def get_video(ind): 23 | return frame_convert.video_cv(freenect.sync_get_video(ind)[0]) 24 | 25 | 26 | while 1: 27 | print(ind) 28 | try: 29 | depth = get_depth(ind) 30 | video = get_video(ind) 31 | except TypeError: 32 | ind = 0 33 | continue 34 | ind += 1 35 | cv.ShowImage('Depth', depth) 36 | cv.ShowImage('Video', video) 37 | if cv.WaitKey(10) == 27: 38 | break 39 | #freenect.sync_stop() # NOTE: Uncomment if your machine can't handle it 40 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Josh Grunzweig & Eric Monti 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv2_sync_multi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """This goes through each kinect on your system, grabs one frame and 3 | displays it. Uncomment the commented line to shut down after each frame 4 | if your system can't handle it (will get very low FPS but it should work). 5 | This will keep trying indeces until it finds one that doesn't work, then it 6 | starts from 0. 7 | """ 8 | import freenect 9 | import cv2 10 | import frame_convert2 11 | 12 | cv2.namedWindow('Depth') 13 | cv2.namedWindow('Video') 14 | ind = 0 15 | print('%s\nPress ESC to stop' % __doc__) 16 | 17 | 18 | def get_depth(ind): 19 | return frame_convert2.pretty_depth_cv(freenect.sync_get_depth(ind)[0]) 20 | 21 | 22 | def get_video(ind): 23 | return frame_convert2.video_cv(freenect.sync_get_video(ind)[0]) 24 | 25 | 26 | while 1: 27 | print(ind) 28 | try: 29 | depth = get_depth(ind) 30 | video = get_video(ind) 31 | except TypeError: 32 | ind = 0 33 | continue 34 | ind += 1 35 | cv2.imshow('Depth', depth) 36 | cv2.imshow('Video', video) 37 | if cv2.waitKey(10) == 27: 38 | break 39 | #freenect.sync_stop() # NOTE: Uncomment if your machine can't handle it 40 | -------------------------------------------------------------------------------- /fakenect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # Fakenect Mock Library 3 | ###################################################################################### 4 | SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) 5 | SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib/fakenect) 6 | include_directories(../src) 7 | add_library (fakenect SHARED fakenect.c parson.c ../src/registration.c) 8 | set_target_properties ( fakenect PROPERTIES 9 | VERSION ${PROJECT_VER} 10 | SOVERSION ${PROJECT_APIVER} 11 | OUTPUT_NAME fakenect) 12 | target_link_libraries(fakenect ${MATH_LIB}) 13 | 14 | install (TARGETS fakenect 15 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}/fakenect") 16 | 17 | add_executable(fakenect-record record.c parson.c) 18 | target_link_libraries(fakenect-record freenect ${MATH_LIB}) 19 | install (TARGETS fakenect-record 20 | DESTINATION bin) 21 | 22 | CONFIGURE_FILE("fakenect.sh.in" 23 | "fakenect.sh" 24 | IMMEDIATE @ONLY) 25 | install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fakenect.sh 26 | DESTINATION bin 27 | RENAME fakenect) 28 | 29 | install(FILES fakenect.1 fakenect-record.1 30 | DESTINATION ${PROJECT_MANPAGE_INSTALL_DIR}/man1) 31 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # OpenNI2-FreenectDriver 3 | ###################################################################################### 4 | 5 | cmake_minimum_required(VERSION 3.1.0) 6 | 7 | file(GLOB HEADERS src/*.hpp src/*.h) 8 | file(GLOB SOURCES src/*.cpp) 9 | add_library(FreenectDriver SHARED ${HEADERS} ${SOURCES}) 10 | 11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function") 12 | 13 | set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib/OpenNI2-FreenectDriver) 14 | set_target_properties(FreenectDriver PROPERTIES 15 | VERSION ${PROJECT_VER} 16 | SOVERSION ${PROJECT_APIVER} 17 | OUTPUT_NAME FreenectDriver) 18 | 19 | add_definitions(-DPROJECT_VER="${PROJECT_VER}") 20 | 21 | include_directories(extern/OpenNI-Linux-x64-2.2.0.33/Include) 22 | include_directories(${PROJECT_SOURCE_DIR}/src) 23 | include_directories(${PROJECT_SOURCE_DIR}/wrappers/cpp) 24 | 25 | target_compile_features(FreenectDriver PUBLIC cxx_constexpr) 26 | 27 | target_link_libraries(FreenectDriver freenectstatic ${MATH_LIB}) 28 | 29 | install (TARGETS FreenectDriver 30 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}/OpenNI2-FreenectDriver") 31 | -------------------------------------------------------------------------------- /wrappers/python/demo_mp_async.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import matplotlib.pyplot as mp 4 | import signal 5 | import frame_convert 6 | 7 | mp.ion() 8 | image_rgb = None 9 | image_depth = None 10 | keep_running = True 11 | 12 | 13 | def display_depth(dev, data, timestamp): 14 | global image_depth 15 | data = frame_convert.pretty_depth(data) 16 | mp.gray() 17 | mp.figure(1) 18 | if image_depth: 19 | image_depth.set_data(data) 20 | else: 21 | image_depth = mp.imshow(data, interpolation='nearest', animated=True) 22 | mp.draw() 23 | 24 | 25 | def display_rgb(dev, data, timestamp): 26 | global image_rgb 27 | mp.figure(2) 28 | if image_rgb: 29 | image_rgb.set_data(data) 30 | else: 31 | image_rgb = mp.imshow(data, interpolation='nearest', animated=True) 32 | mp.draw() 33 | 34 | 35 | def body(*args): 36 | if not keep_running: 37 | raise freenect.Kill 38 | 39 | 40 | def handler(signum, frame): 41 | global keep_running 42 | keep_running = False 43 | 44 | 45 | print('Press Ctrl-C in terminal to stop') 46 | signal.signal(signal.SIGINT, handler) 47 | freenect.runloop(depth=display_depth, 48 | video=display_rgb, 49 | body=body) 50 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv2_threshold.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import cv2 4 | import frame_convert2 5 | import numpy as np 6 | 7 | 8 | threshold = 100 9 | current_depth = 0 10 | 11 | 12 | def change_threshold(value): 13 | global threshold 14 | threshold = value 15 | 16 | 17 | def change_depth(value): 18 | global current_depth 19 | current_depth = value 20 | 21 | 22 | def show_depth(): 23 | global threshold 24 | global current_depth 25 | 26 | depth, timestamp = freenect.sync_get_depth() 27 | depth = 255 * np.logical_and(depth >= current_depth - threshold, 28 | depth <= current_depth + threshold) 29 | depth = depth.astype(np.uint8) 30 | cv2.imshow('Depth', depth) 31 | 32 | 33 | def show_video(): 34 | cv2.imshow('Video', frame_convert2.video_cv(freenect.sync_get_video()[0])) 35 | 36 | 37 | cv2.namedWindow('Depth') 38 | cv2.namedWindow('Video') 39 | cv2.createTrackbar('threshold', 'Depth', threshold, 500, change_threshold) 40 | cv2.createTrackbar('depth', 'Depth', current_depth, 2048, change_depth) 41 | 42 | print('Press ESC in window to stop') 43 | 44 | 45 | while 1: 46 | show_depth() 47 | show_video() 48 | if cv2.waitKey(10) == 27: 49 | break 50 | -------------------------------------------------------------------------------- /wrappers/python/frame_convert2.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def pretty_depth(depth): 5 | """Converts depth into a 'nicer' format for display 6 | 7 | This is abstracted to allow for experimentation with normalization 8 | 9 | Args: 10 | depth: A numpy array with 2 bytes per pixel 11 | 12 | Returns: 13 | A numpy array that has been processed with unspecified datatype 14 | """ 15 | np.clip(depth, 0, 2**10 - 1, depth) 16 | depth >>= 2 17 | depth = depth.astype(np.uint8) 18 | return depth 19 | 20 | 21 | def pretty_depth_cv(depth): 22 | """Converts depth into a 'nicer' format for display 23 | 24 | This is abstracted to allow for experimentation with normalization 25 | 26 | Args: 27 | depth: A numpy array with 2 bytes per pixel 28 | 29 | Returns: 30 | A numpy array with unspecified datatype 31 | """ 32 | return pretty_depth(depth) 33 | 34 | 35 | def video_cv(video): 36 | """Converts video into a BGR format for display 37 | 38 | This is abstracted out to allow for experimentation 39 | 40 | Args: 41 | video: A numpy array with 1 byte per pixel, 3 channels RGB 42 | 43 | Returns: 44 | A numpy array with with 1 byte per pixel, 3 channels BGR 45 | """ 46 | return video[:, :, ::-1] # RGB -> BGR 47 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/LogHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | public interface LogHandler { 28 | void onMessage(Device dev, LogLevel level, String msg); 29 | } -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/lib/freenect.rb: -------------------------------------------------------------------------------- 1 | 2 | # we may one day have a native extension for bindings... for now only 3 | # ffi/freenect exists 4 | require 'ffi/freenect' 5 | require 'freenect/context' 6 | require 'freenect/device' 7 | 8 | module Freenect 9 | include FFI::Freenect 10 | FrameMode = FFI::Freenect::FrameMode 11 | 12 | def self.init(*args) 13 | Context.new(*args) 14 | end 15 | 16 | def self.num_video_modes 17 | ::FFI::Freenect.freenect_get_video_mode_count() 18 | end 19 | def self.video_mode(a,b=nil) 20 | x = if a.is_a?(Numeric) 21 | ::FFI::Freenect.freenect_get_video_mode(a) 22 | else 23 | ::FFI::Freenect.freenect_find_video_mode(a,b) 24 | end 25 | x.frame_mode_type = :video unless x.nil? 26 | x 27 | end 28 | def self.video_modes 29 | (0...self.num_video_modes).map do |ii| 30 | self.video_mode(ii) 31 | end 32 | end 33 | 34 | def self.num_depth_modes 35 | ::FFI::Freenect.freenect_get_depth_mode_count() 36 | end 37 | def self.depth_mode(a,b=nil) 38 | x = if a.is_a?(Numeric) 39 | ::FFI::Freenect.freenect_get_depth_mode(a) 40 | else 41 | ::FFI::Freenect.freenect_find_depth_mode(a,b) 42 | end 43 | x.frame_mode_type = :depth unless x.nil? 44 | x 45 | end 46 | def self.depth_modes 47 | (0...self.num_depth_modes).map do |ii| 48 | self.depth_mode(ii) 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/DepthHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.nio.ByteBuffer; 28 | 29 | public interface DepthHandler { 30 | void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp); 31 | } -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/VideoHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.nio.ByteBuffer; 28 | 29 | public interface VideoHandler { 30 | void onFrameReceived(FrameMode mode, ByteBuffer frame, int timestamp); 31 | } -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | 4 | begin 5 | require 'jeweler' 6 | Jeweler::Tasks.new do |gem| 7 | gem.name = "ffi-libfreenect" 8 | gem.summary = gem.description = %Q{FFI bindings for the libfreenect OpenKinect library} 9 | gem.homepage = "http://github.com/jgrunzweig/ffi-libfreenect" 10 | gem.authors = ["Josh Grunzweig", "Eric Monti"] 11 | 12 | gem.rdoc_options += ["--title", "FFI Freenect", "--main", "README.rdoc", "--line-numbers"] 13 | gem.add_dependency("ffi", ">= 0.5.0") 14 | 15 | # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings 16 | end 17 | Jeweler::GemcutterTasks.new 18 | rescue LoadError 19 | puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" 20 | end 21 | 22 | require 'rspec/core/rake_task' 23 | RSpec::Core::RakeTask.new(:spec) do |spec| 24 | spec.pattern = 'spec/**/*_spec.rb' 25 | end 26 | 27 | RSpec::Core::RakeTask.new(:rcov) do |spec| 28 | #spec.libs << 'lib' << 'spec' 29 | spec.pattern = 'spec/**/*_spec.rb' 30 | spec.rcov = true 31 | end 32 | 33 | task :spec => :check_dependencies 34 | 35 | task :default => :spec 36 | 37 | begin 38 | require 'yard' 39 | YARD::Rake::YardocTask.new 40 | rescue LoadError 41 | task :yardoc do 42 | abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard" 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/Context.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | public interface Context { 28 | int numDevices(); 29 | void setLogHandler(LogHandler handler); 30 | void setLogLevel(LogLevel level); 31 | Device openDevice(int index); 32 | void shutdown(); 33 | } 34 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/VS2010/freenectdotnet.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C# Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "freenectdotnet", "freenectdotnet.csproj", "{360413F9-4D9B-46BE-BEC7-9B666850ED8C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|x64 = Debug|x64 10 | Release|Any CPU = Release|Any CPU 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Debug|x64.ActiveCfg = Debug|x64 17 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Debug|x64.Build.0 = Debug|x64 18 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Release|x64.ActiveCfg = Release|x64 21 | {360413F9-4D9B-46BE-BEC7-9B666850ED8C}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(MonoDevelopProperties) = preSolution 27 | StartupItem = freenectdotnet.csproj 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /wrappers/python/demo_cv_threshold.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import freenect 3 | import cv 4 | import frame_convert 5 | import numpy as np 6 | 7 | 8 | threshold = 100 9 | current_depth = 0 10 | 11 | 12 | def change_threshold(value): 13 | global threshold 14 | threshold = value 15 | 16 | 17 | def change_depth(value): 18 | global current_depth 19 | current_depth = value 20 | 21 | 22 | def show_depth(): 23 | global threshold 24 | global current_depth 25 | 26 | depth, timestamp = freenect.sync_get_depth() 27 | depth = 255 * np.logical_and(depth >= current_depth - threshold, 28 | depth <= current_depth + threshold) 29 | depth = depth.astype(np.uint8) 30 | image = cv.CreateImageHeader((depth.shape[1], depth.shape[0]), 31 | cv.IPL_DEPTH_8U, 32 | 1) 33 | cv.SetData(image, depth.tostring(), 34 | depth.dtype.itemsize * depth.shape[1]) 35 | cv.ShowImage('Depth', image) 36 | 37 | 38 | def show_video(): 39 | cv.ShowImage('Video', frame_convert.video_cv(freenect.sync_get_video()[0])) 40 | 41 | 42 | cv.NamedWindow('Depth') 43 | cv.NamedWindow('Video') 44 | cv.CreateTrackbar('threshold', 'Depth', threshold, 500, change_threshold) 45 | cv.CreateTrackbar('depth', 'Depth', current_depth, 2048, change_depth) 46 | 47 | print('Press ESC in window to stop') 48 | 49 | 50 | while 1: 51 | show_depth() 52 | show_video() 53 | if cv.WaitKey(10) == 27: 54 | break 55 | -------------------------------------------------------------------------------- /src/cameras.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010-2011 individual OpenKinect contributors. See the CONTRIB 5 | * file for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "libfreenect.h" 30 | 31 | // Just a couple function declarations. 32 | 33 | // These are called by core.c to do camera-specific initialization that needs 34 | // camera-specific protocol support. 35 | int freenect_camera_init(freenect_device *dev); 36 | int freenect_camera_teardown(freenect_device *dev); 37 | -------------------------------------------------------------------------------- /wrappers/actionscript/server/as3_jpeg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | int RGB_2_JPEG(unsigned char *buffer, unsigned char **compressed, long unsigned int *new_len, int quality); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/DeviceFlags.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | public enum DeviceFlags { 28 | MOTOR(1), 29 | CAMERA(2), 30 | AUDIO(4); 31 | 32 | private final int value; 33 | 34 | private DeviceFlags(int value) { 35 | this.value = value; 36 | } 37 | 38 | public int intValue() { 39 | return value; 40 | } 41 | } -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/objects/as3kinectCalibrationParams.as: -------------------------------------------------------------------------------- 1 | package org.as3kinect.objects { 2 | /** 3 | * @author stevie 4 | * @date 29.06.2011 5 | */ 6 | public class as3kinectCalibrationParams { 7 | public var screenHeight : int = 0; 8 | public var screenWidth : int = 0; 9 | public var xOffsetTop : Number; 10 | public var xOffsetDifference : Number; 11 | public var xScreenFactorTop : Number; 12 | public var xScreenFactorDifference : Number; 13 | public var yOffset : Number; 14 | public var yScreenFactor : Number; 15 | public var sliceRectY : Number = 0; 16 | public var sliceRectHeight : Number = 20; 17 | public var calibrationComplete : Boolean; 18 | 19 | public function toString() : String{ 20 | var str : String = "screenHeight: " + screenHeight + "\n"; 21 | str += "screenHeight: " + screenHeight + "\n"; 22 | str += "screenWidth: " + screenWidth + "\n"; 23 | str += "xOffsetTop: " + xOffsetTop + "\n"; 24 | str += "xOffsetDifference: " + xOffsetDifference + "\n"; 25 | str += "xScreenFactorTop: " + xScreenFactorTop + "\n"; 26 | str += "xScreenFactorDifference: " + xScreenFactorDifference + "\n"; 27 | str += "yOffset: " + yOffset + "\n"; 28 | str += "yScreenFactor: " + yScreenFactor + "\n"; 29 | str += "sliceRectY: " + sliceRectY + "\n"; 30 | str += "slicsliceRectHeighteRectY: " + sliceRectHeight + "\n"; 31 | 32 | return str; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/objects/motorData.as: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of the OpenKinect Project. http://www.openkinect.org 4 | * 5 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 6 | * for details. 7 | * 8 | * This code is licensed to you under the terms of the Apache License, version 9 | * 2.0, or, at your option, the terms of the GNU General Public License, 10 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 11 | * or the following URLs: 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * http://www.gnu.org/licenses/gpl-2.0.txt 14 | * 15 | * If you redistribute this file in source form, modified or unmodified, 16 | * you may: 17 | * 1) Leave this header intact and distribute it under the same terms, 18 | * accompanying it with the APACHE20 and GPL20 files, or 19 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 20 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 21 | * In all cases you must keep the copyright notice intact and include a copy 22 | * of the CONTRIB file. 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | * 26 | */ 27 | 28 | package org.as3kinect.objects { 29 | 30 | public class motorData { 31 | public var ax : uint; 32 | public var ay : uint; 33 | public var az : uint; 34 | public var dx : Number; 35 | public var dy : Number; 36 | public var dz : Number; 37 | 38 | public function motorData() { 39 | this.ax = 0; 40 | this.ay = 0; 41 | this.az = 0; 42 | this.dx = 0; 43 | this.dy = 0; 44 | this.dz = 0; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/registration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2011 individual OpenKinect contributors. See the CONTRIB 5 | * file for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include "libfreenect.h" 31 | 32 | // Internal function declarations relating to registration 33 | int freenect_init_registration(freenect_device* dev); 34 | int freenect_apply_registration(freenect_device* dev, uint8_t* input, uint16_t* output_mm, bool unpacked); 35 | int freenect_apply_depth_to_mm(freenect_device* dev, uint8_t* input_packed, uint16_t* output_mm); 36 | int freenect_apply_depth_unpacked_to_mm(freenect_device* dev, uint16_t* input, uint16_t* output_mm); 37 | -------------------------------------------------------------------------------- /src/flags.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010-2011 individual OpenKinect contributors. See the CONTRIB 5 | * file for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include "libfreenect.h" 30 | 31 | 32 | int send_cmd(freenect_device *dev, uint16_t cmd, void *cmdbuf, unsigned int cmd_len, void *replybuf, int reply_len); 33 | 34 | // returns UINT16_MAX on error 35 | uint16_t read_register(freenect_device *dev, uint16_t reg); 36 | int write_register(freenect_device *dev, uint16_t reg, uint16_t data); 37 | 38 | // returns UINT16_MAX on error 39 | uint16_t read_cmos_register(freenect_device *dev, uint16_t reg); 40 | int write_cmos_register(freenect_device *dev, uint16_t reg, uint16_t value); 41 | -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/events/as3kinectSocketEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of the OpenKinect Project. http://www.openkinect.org 4 | * 5 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 6 | * for details. 7 | * 8 | * This code is licensed to you under the terms of the Apache License, version 9 | * 2.0, or, at your option, the terms of the GNU General Public License, 10 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 11 | * or the following URLs: 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * http://www.gnu.org/licenses/gpl-2.0.txt 14 | * 15 | * If you redistribute this file in source form, modified or unmodified, 16 | * you may: 17 | * 1) Leave this header intact and distribute it under the same terms, 18 | * accompanying it with the APACHE20 and GPL20 files, or 19 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 20 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 21 | * In all cases you must keep the copyright notice intact and include a copy 22 | * of the CONTRIB file. 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | * 26 | */ 27 | 28 | package org.as3kinect.events 29 | { 30 | import flash.events.Event; 31 | 32 | public class as3kinectSocketEvent extends Event 33 | { 34 | 35 | public static const ONCONNECT:String = "ONCONNECT"; 36 | public static const ONDATA:String = "ONDATA"; 37 | public static const ONERROR:String = "ONERROR"; 38 | 39 | public var data:*; 40 | 41 | public function as3kinectSocketEvent(type:String, data:*) 42 | { 43 | this.data = data; 44 | super(type); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /wrappers/csharp/src/test/KinectDemo/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Windows.Forms; 30 | 31 | namespace KinectDemo 32 | { 33 | static class Program 34 | { 35 | /// 36 | /// The main entry point for the application. 37 | /// 38 | [STAThread] 39 | static void Main() 40 | { 41 | Application.EnableVisualStyles(); 42 | Application.SetCompatibleTextRenderingDefault(false); 43 | Application.Run(new MainWindow()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/lib/freenect/context.rb: -------------------------------------------------------------------------------- 1 | require 'ffi/freenect' 2 | require 'freenect/device' 3 | 4 | module Freenect 5 | class ContextError < StandardError 6 | end 7 | 8 | class Context 9 | def initialize(usb_ctx=nil) 10 | ctx_p = FFI::MemoryPointer.new(:pointer) 11 | if ::FFI::Freenect.freenect_init(ctx_p, usb_ctx) != 0 12 | raise ContextError, "freenect_init() returned nonzero" 13 | elsif ctx_p.null? 14 | raise ContextError, "freenect_init() produced a NULL context" 15 | end 16 | @ctx = ctx_p.read_pointer 17 | end 18 | 19 | def context 20 | if @ctx_closed 21 | raise ContextError, "This context has been shut down and can no longer be used" 22 | else 23 | return @ctx 24 | end 25 | end 26 | 27 | def num_devices 28 | ::FFI::Freenect.freenect_num_devices(self.context) 29 | end 30 | 31 | def open_device(idx) 32 | return Device.new(self, idx) 33 | end 34 | 35 | alias [] open_device 36 | 37 | def set_log_level(loglevel) 38 | ::FFI::Freenect.freenect_set_log_level(self.context, loglevel) 39 | end 40 | 41 | alias log_level= set_log_level 42 | 43 | def set_log_callback(&block) 44 | ::FFI::Freenect.freenect_set_log_callback(self.context, block) 45 | end 46 | 47 | def process_events 48 | ::FFI::Freenect.freenect_process_events(self.context) 49 | end 50 | 51 | def close 52 | unless closed? 53 | if ::FFI::Freenect.freenect_shutdown(@ctx) != 0 54 | raise ContextError, "freenect_shutdown() returned nonzero" 55 | end 56 | @ctx_closed = true 57 | end 58 | end 59 | 60 | alias shutdown close 61 | 62 | def closed? 63 | @ctx_closed == true 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /wrappers/java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.openkinect 6 | freenect 7 | 1.0 8 | 9 | 10 | 11 | net.java.dev.jna 12 | jna 13 | 3.2.3 14 | compile 15 | 16 | 17 | junit 18 | junit 19 | 4.8.2 20 | test 21 | 22 | 23 | org.hamcrest 24 | hamcrest-library 25 | 1.2 26 | test 27 | 28 | 29 | 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-compiler-plugin 35 | 2.3.2 36 | 37 | 38 | 1.6 39 | 1.6 40 | 41 | 42 | 43 | maven-assembly-plugin 44 | 45 | 46 | jar-with-dependencies 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/examples/video_snapshot.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Actual video and depth capture work similarly to eachother. 3 | # But they're still both pretty un-sugary. 4 | # 5 | # Future versions will probably abstract this and try to make it more 6 | # ruby-ish. 7 | # 8 | # The example below shows how to capture a single video frame to a PPM file. 9 | 10 | $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib")) 11 | require 'freenect' 12 | ctx = Freenect.init() 13 | 14 | devs = ctx.num_devices 15 | 16 | STDERR.puts "Number of Kinects detected: #{devs}" 17 | unless devs > 0 18 | STDERR.puts "Error: no kinect detected" 19 | exit 1 20 | end 21 | 22 | STDERR.puts "Selecting device 0" 23 | dev = ctx.open_device(0) 24 | 25 | dev.led = :green # play with the led 26 | 27 | dev.video_mode = Freenect.video_mode(:medium, :rgb) 28 | dev.start_video() 29 | 30 | # Or to grab depth: 31 | # dev.depth_mode = Freenect.depth_mode(:medium, :depth_11bit) 32 | # dev.start_depth() 33 | 34 | 35 | $snapshot_finished = nil 36 | 37 | STDERR.puts "Attempting snapshot" 38 | dev.set_video_callback do |device, video, timestamp| 39 | if not $snapshot_finished 40 | fname = "%i.ppm" % timestamp 41 | STDERR.puts "Writing #{fname}" 42 | File.open(fname, "w") do |f| 43 | f.puts("P6 %d %d 255\n" % [ dev.video_mode.width, dev.video_mode.height ] ) 44 | f.write(video.read_string_length(dev.video_mode.bytes)) 45 | end 46 | $snapshot_finished = true 47 | end 48 | end 49 | 50 | ret = -1 51 | until $snapshot_finished 52 | break if (ret=ctx.process_events) < 0 53 | end 54 | 55 | if ret < 0 56 | STDERR.puts "Error: unable to take snapshot. process_events code=#{ret}" 57 | end 58 | 59 | dev.led = :off 60 | dev.stop_video 61 | # Or 62 | # dev.stop_depth 63 | 64 | dev.close 65 | ctx.close 66 | 67 | 68 | -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/as3kinectWrapperEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of the OpenKinect Project. http://www.openkinect.org 4 | * 5 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 6 | * for details. 7 | * 8 | * This code is licensed to you under the terms of the Apache License, version 9 | * 2.0, or, at your option, the terms of the GNU General Public License, 10 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 11 | * or the following URLs: 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * http://www.gnu.org/licenses/gpl-2.0.txt 14 | * 15 | * If you redistribute this file in source form, modified or unmodified, 16 | * you may: 17 | * 1) Leave this header intact and distribute it under the same terms, 18 | * accompanying it with the APACHE20 and GPL20 files, or 19 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 20 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 21 | * In all cases you must keep the copyright notice intact and include a copy 22 | * of the CONTRIB file. 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | * 26 | */ 27 | 28 | package org.as3kinect.events 29 | { 30 | import flash.events.Event; 31 | import flash.sampler.StackFrame; 32 | 33 | public class as3kinectWrapperEvent extends Event 34 | { 35 | 36 | public static const ON_DEPTH:String = "ON_DEPTH"; 37 | public static const ON_RAW_DEPTH:String = "ON_RAW_DEPTH"; 38 | public static const ON_DEBUG:String = "ON_DEBUG"; 39 | public static const ON_VIDEO:String = "ON_VIDEO"; 40 | public static const ON_ACCELEROMETER:String = "ON_ACCELEROMETER"; 41 | 42 | public var data:*; 43 | 44 | public function as3kinectWrapperEvent(type:String, data:*) 45 | { 46 | this.data = data; 47 | super(type); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /wrappers/actionscript/org/as3kinect/events/as3kinectWrapperEvent.as: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of the OpenKinect Project. http://www.openkinect.org 4 | * 5 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 6 | * for details. 7 | * 8 | * This code is licensed to you under the terms of the Apache License, version 9 | * 2.0, or, at your option, the terms of the GNU General Public License, 10 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 11 | * or the following URLs: 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * http://www.gnu.org/licenses/gpl-2.0.txt 14 | * 15 | * If you redistribute this file in source form, modified or unmodified, 16 | * you may: 17 | * 1) Leave this header intact and distribute it under the same terms, 18 | * accompanying it with the APACHE20 and GPL20 files, or 19 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 20 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 21 | * In all cases you must keep the copyright notice intact and include a copy 22 | * of the CONTRIB file. 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | * 26 | */ 27 | 28 | package org.as3kinect.events 29 | { 30 | import flash.events.Event; 31 | import flash.sampler.StackFrame; 32 | 33 | public class as3kinectWrapperEvent extends Event 34 | { 35 | 36 | public static const ON_DEPTH:String = "ON_DEPTH"; 37 | public static const ON_RAW_DEPTH:String = "ON_RAW_DEPTH"; 38 | public static const ON_DEBUG:String = "ON_DEBUG"; 39 | public static const ON_VIDEO:String = "ON_VIDEO"; 40 | public static const ON_ACCELEROMETER:String = "ON_ACCELEROMETER"; 41 | 42 | public var data:*; 43 | 44 | public function as3kinectWrapperEvent(type:String, data:*) 45 | { 46 | this.data = data; 47 | super(type); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /wrappers/python/frame_convert.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def pretty_depth(depth): 5 | """Converts depth into a 'nicer' format for display 6 | 7 | This is abstracted to allow for experimentation with normalization 8 | 9 | Args: 10 | depth: A numpy array with 2 bytes per pixel 11 | 12 | Returns: 13 | A numpy array that has been processed whos datatype is unspecified 14 | """ 15 | np.clip(depth, 0, 2**10 - 1, depth) 16 | depth >>= 2 17 | depth = depth.astype(np.uint8) 18 | return depth 19 | 20 | 21 | def pretty_depth_cv(depth): 22 | """Converts depth into a 'nicer' format for display 23 | 24 | This is abstracted to allow for experimentation with normalization 25 | 26 | Args: 27 | depth: A numpy array with 2 bytes per pixel 28 | 29 | Returns: 30 | An opencv image who's datatype is unspecified 31 | """ 32 | import cv 33 | depth = pretty_depth(depth) 34 | image = cv.CreateImageHeader((depth.shape[1], depth.shape[0]), 35 | cv.IPL_DEPTH_8U, 36 | 1) 37 | cv.SetData(image, depth.tostring(), 38 | depth.dtype.itemsize * depth.shape[1]) 39 | return image 40 | 41 | 42 | def video_cv(video): 43 | """Converts video into a BGR format for opencv 44 | 45 | This is abstracted out to allow for experimentation 46 | 47 | Args: 48 | video: A numpy array with 1 byte per pixel, 3 channels RGB 49 | 50 | Returns: 51 | An opencv image who's datatype is 1 byte, 3 channel BGR 52 | """ 53 | import cv 54 | video = video[:, :, ::-1] # RGB -> BGR 55 | image = cv.CreateImageHeader((video.shape[1], video.shape[0]), 56 | cv.IPL_DEPTH_8U, 57 | 3) 58 | cv.SetData(image, video.tostring(), 59 | video.dtype.itemsize * 3 * video.shape[1]) 60 | return image 61 | -------------------------------------------------------------------------------- /doc/DoxygenMainpage.h: -------------------------------------------------------------------------------- 1 | /** 2 | @mainpage libfreenect 3 | @author The OpenKinect Community - http://www.github.com/openkinect 4 | 5 | Cross-platform driver for the Microsoft Kinect Camera 6 | 7 | Website: http://www.openkinect.org 8 | 9 | @section libfreenectIntro Introduction 10 | 11 | libfreenect is an open source, cross platform development library for 12 | the Microsoft Kinect camera. It provides basic functionality to 13 | connect to the camera, set configuration values, retrieve (and in some 14 | cases decompress) images, and provides functionalty for the LED and 15 | Motor. 16 | 17 | @section libfreenectDesignOverview Design Overview 18 | 19 | libfreenect provides access to devices via two structs: 20 | 21 | - A context, which manages aspects of thread safety when using 22 | multiple devices on multiple threads. 23 | - A device, which talks to the hardware and manages transfers and configuration. 24 | 25 | Either or both of these structs are passed to the functions in order 26 | to interact with the hardware. The USB access is handled by 27 | libusb-1.0, which should work in a mostly non-blocking fashion across 28 | all platforms (see function documentation for specifics). 29 | 30 | @section libfreenectShouldIUseIt Should You Use libfreenect? 31 | 32 | The main design goal of libfreenect is to provide a simple, usable 33 | reference implementation of the Kinect USB protocol for access via 34 | non-Xbox hardware. With this in mind, the library does not contain any 35 | algorithms relevant to computer vision usages of the camera. 36 | 37 | If you are looking for machine vision algorithms, we recommend the 38 | OpenCV library, available at 39 | 40 | http://www.opencv.org 41 | 42 | If you are looking to use the kinect in a larger framework that may 43 | involve other depth sensors, we recommend the OpenNI framework, 44 | available at 45 | 46 | http://www.openni.org 47 | 48 | Note that libfreenect can be used as a hardware node in OpenNI. 49 | 50 | */ 51 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/Resolution.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public enum Resolution { 31 | LOW(0), 32 | MEDIUM(1), 33 | HIGH(2); 34 | 35 | private final int value; 36 | private static final Map MAP = new HashMap(3); 37 | static { 38 | for(Resolution v : Resolution.values()) { 39 | MAP.put(v.intValue(), v); 40 | } 41 | } 42 | 43 | private Resolution(int value) { 44 | this.value = value; 45 | } 46 | 47 | public int intValue() { 48 | return value; 49 | } 50 | 51 | public static Resolution fromInt(int value) { 52 | return MAP.get(value); 53 | } 54 | } -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/TiltStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public enum TiltStatus { 31 | STOPPED(0), 32 | LIMIT(1), 33 | MOVING(4); 34 | 35 | private final int value; 36 | private static final Map MAP = new HashMap(3); 37 | static { 38 | for(TiltStatus v : TiltStatus.values()) { 39 | MAP.put(v.intValue(), v); 40 | } 41 | } 42 | 43 | private TiltStatus(int value) { 44 | this.value = value; 45 | } 46 | 47 | public int intValue() { 48 | return value; 49 | } 50 | 51 | public static TiltStatus fromInt(int value) { 52 | return MAP.get(value); 53 | } 54 | } -------------------------------------------------------------------------------- /wrappers/opencv/cvdemo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "libfreenect_cv.h" 4 | 5 | IplImage *GlViewColor(IplImage *depth) 6 | { 7 | static IplImage *image = 0; 8 | if (!image) image = cvCreateImage(cvSize(640,480), 8, 3); 9 | unsigned char *depth_mid = (unsigned char*)(image->imageData); 10 | int i; 11 | for (i = 0; i < 640*480; i++) { 12 | int lb = ((short *)depth->imageData)[i] % 256; 13 | int ub = ((short *)depth->imageData)[i] / 256; 14 | switch (ub) { 15 | case 0: 16 | depth_mid[3*i+2] = 255; 17 | depth_mid[3*i+1] = 255-lb; 18 | depth_mid[3*i+0] = 255-lb; 19 | break; 20 | case 1: 21 | depth_mid[3*i+2] = 255; 22 | depth_mid[3*i+1] = lb; 23 | depth_mid[3*i+0] = 0; 24 | break; 25 | case 2: 26 | depth_mid[3*i+2] = 255-lb; 27 | depth_mid[3*i+1] = 255; 28 | depth_mid[3*i+0] = 0; 29 | break; 30 | case 3: 31 | depth_mid[3*i+2] = 0; 32 | depth_mid[3*i+1] = 255; 33 | depth_mid[3*i+0] = lb; 34 | break; 35 | case 4: 36 | depth_mid[3*i+2] = 0; 37 | depth_mid[3*i+1] = 255-lb; 38 | depth_mid[3*i+0] = 255; 39 | break; 40 | case 5: 41 | depth_mid[3*i+2] = 0; 42 | depth_mid[3*i+1] = 0; 43 | depth_mid[3*i+0] = 255-lb; 44 | break; 45 | default: 46 | depth_mid[3*i+2] = 0; 47 | depth_mid[3*i+1] = 0; 48 | depth_mid[3*i+0] = 0; 49 | break; 50 | } 51 | } 52 | return image; 53 | } 54 | 55 | int main(int argc, char **argv) 56 | { 57 | while (cvWaitKey(10) < 0) { 58 | IplImage *image = freenect_sync_get_rgb_cv(0); 59 | if (!image) { 60 | printf("Error: Kinect not connected?\n"); 61 | return -1; 62 | } 63 | cvCvtColor(image, image, CV_RGB2BGR); 64 | IplImage *depth = freenect_sync_get_depth_cv(0); 65 | if (!depth) { 66 | printf("Error: Kinect not connected?\n"); 67 | return -1; 68 | } 69 | cvShowImage("RGB", image); 70 | cvShowImage("Depth", GlViewColor(depth)); 71 | } 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/Device.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | public interface Device { 28 | double[] getAccel(); 29 | int setLed(LedStatus status); 30 | void refreshTiltState(); 31 | double getTiltAngle(); 32 | int setTiltAngle(double angle); 33 | TiltStatus getTiltStatus(); 34 | void setDepthFormat(DepthFormat fmt); 35 | void setVideoFormat(VideoFormat fmt); 36 | void setDepthFormat(DepthFormat fmt, Resolution res); 37 | void setVideoFormat(VideoFormat fmt, Resolution res); 38 | FrameMode getDepthMode(); 39 | FrameMode getVideoMode(); 40 | int startDepth(DepthHandler handler); 41 | int startVideo(VideoHandler handler); 42 | int stopDepth(); 43 | int stopVideo(); 44 | void close(); 45 | public abstract int getDeviceIndex(); 46 | } -------------------------------------------------------------------------------- /platform/windows/unistd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include 31 | 32 | // MinGW defines _SSIZE_T_DEFINED in sys/types.h when it defines ssize_t to be a long. 33 | // Redefining it causes an error. 34 | // MSVC does not define this. 35 | #ifndef _SSIZE_T_DEFINED 36 | #define _SSIZE_T_DEFINED 37 | #ifdef _WIN64 38 | typedef __int64 ssize_t; 39 | #else 40 | typedef int ssize_t; 41 | #endif 42 | #endif // _SSIZE_T_DEFINED 43 | 44 | 45 | static void usleep(__int64 usec) 46 | { 47 | // Convert to 100 nanosecond interval, negative for relative time. 48 | LARGE_INTEGER ft; 49 | ft.QuadPart = -(10 * usec); 50 | 51 | HANDLE timer = CreateWaitableTimer(NULL, TRUE, NULL); 52 | SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); 53 | WaitForSingleObject(timer, INFINITE); 54 | CloseHandle(timer); 55 | } 56 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/LogLevel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public enum LogLevel { 31 | FATAL(0), 32 | ERROR(1), 33 | WARNING(2), 34 | NOTICE(3), 35 | INFO(4), 36 | DEBUG(5), 37 | SPEW(6), 38 | FLOOD(7); 39 | 40 | private final int value; 41 | private static final Map MAP = new HashMap(8); 42 | static { 43 | for(LogLevel v : LogLevel.values()) { 44 | MAP.put(v.intValue(), v); 45 | } 46 | } 47 | 48 | private LogLevel(int value) { 49 | this.value = value; 50 | } 51 | 52 | public int intValue() { 53 | return value; 54 | } 55 | 56 | public static LogLevel fromInt(int value) { 57 | return MAP.get(value); 58 | } 59 | } -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/DepthFormat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public enum DepthFormat { 31 | D11BIT(0), 32 | D10BIT(1), 33 | D11BIT_PACKED(2), 34 | D10BIT_PACKED(3), 35 | REGISTERED(4), 36 | MM(5); 37 | 38 | private final int value; 39 | private static final Map MAP = new HashMap(6); 40 | static { 41 | for(DepthFormat v : DepthFormat.values()) { 42 | MAP.put(v.intValue(), v); 43 | } 44 | } 45 | 46 | private DepthFormat(int value) { 47 | this.value = value; 48 | } 49 | 50 | public int intValue() { 51 | return value; 52 | } 53 | 54 | public static DepthFormat fromInt(int value) { 55 | return MAP.get(value); 56 | } 57 | } -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/LedStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public enum LedStatus { 31 | OFF(0), 32 | GREEN(1), 33 | RED(2), 34 | YELLOW(3), 35 | BLINK_YELLOW(4), 36 | BLINK_GREEN(5), 37 | BLINK_RED_YELLOW(6); 38 | 39 | private final int value; 40 | private static final Map MAP = new HashMap(7); 41 | static { 42 | for(LedStatus v : LedStatus.values()) { 43 | MAP.put(v.intValue(), v); 44 | } 45 | } 46 | 47 | private LedStatus(int value) { 48 | this.value = value; 49 | } 50 | 51 | public int intValue() { 52 | return value; 53 | } 54 | 55 | public static LedStatus fromInt(int value) { 56 | return MAP.get(value); 57 | } 58 | } -------------------------------------------------------------------------------- /platform/windows/libusb10emu/libusb-1.0/failguard.cpp: -------------------------------------------------------------------------------- 1 | #include "failguard.h" 2 | #include "libusbemu_threads.h" 3 | 4 | int ThreadFailGuardProc(void* params); 5 | 6 | namespace libusbemu 7 | { 8 | 9 | namespace failguard 10 | { 11 | 12 | static volatile bool boTriggered (false); 13 | static QuickEvent hReaction; 14 | static volatile int nDecision (0); 15 | 16 | const bool Check() 17 | { 18 | if (failguard::boTriggered) 19 | return(true); 20 | 21 | // CTRL + ALT pressed? 22 | if ((GetKeyState(VK_CONTROL) & 0x8000) && (GetKeyState(VK_MENU) & 0x8000)) 23 | { 24 | // only one thread is allowed to activate the guard 25 | static QuickMutex mutexFailGuard; 26 | if (mutexFailGuard.TryEnter()) 27 | { 28 | if (!failguard::boTriggered) 29 | { 30 | failguard::hReaction.Reset(); 31 | failguard::boTriggered = true; 32 | new QuickThread(ThreadFailGuardProc, NULL, true); 33 | } 34 | mutexFailGuard.Leave(); 35 | } 36 | } 37 | 38 | return(failguard::boTriggered); 39 | } 40 | 41 | void WaitDecision() 42 | { 43 | failguard::hReaction.Wait(); 44 | } 45 | 46 | const bool Abort() 47 | { 48 | return(-1 == nDecision); 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | using namespace libusbemu::failguard; 56 | 57 | int ThreadFailGuardProc(void* params) 58 | { 59 | int user_option = 60 | MessageBoxA(GetDesktopWindow(), 61 | "The libusb_handle_events() fail guard of libusbemu was reached!\n" 62 | "This was caused by pressing and holding the [CTRL] + [ALT] keys.\n" 63 | "If it was unintentional, click Cancel to resume normal execution;\n" 64 | "otherwise, click OK to effectively terminate the thread (note that\n" 65 | "the host program might run abnormally after such termination).", 66 | "WARNING: libusbemu thread fail guard reached!", MB_ICONWARNING | MB_OKCANCEL); 67 | 68 | if (IDOK == user_option) 69 | nDecision = -1; 70 | else 71 | boTriggered = false; 72 | 73 | hReaction.Signal(); 74 | 75 | return(0); 76 | } 77 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/DepthMap.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | using System; 28 | using System.Runtime.InteropServices; 29 | 30 | namespace freenect 31 | { 32 | /// 33 | /// Represents a map of depth values from the DepthCamera 34 | /// 35 | public class DepthMap : BaseDataMap 36 | { 37 | /// 38 | /// Constructor #1 39 | /// 40 | /// 41 | /// A 42 | /// 43 | public DepthMap(FrameMode mode) : base(mode) 44 | { 45 | 46 | } 47 | 48 | /// 49 | /// Constructor #2 50 | /// 51 | /// 52 | /// A 53 | /// 54 | /// 55 | /// A 56 | /// 57 | public DepthMap(FrameMode mode, IntPtr buffer) : base(mode, buffer) 58 | { 59 | 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/VideoFormat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | public enum VideoFormat { 31 | RGB(0), 32 | BAYER(1), 33 | IR_8BIT(2), 34 | IR_10BIT(3), 35 | IR_10BIT_PACKED(4), 36 | YUV_RGB(5), 37 | YUV_RAW(6); 38 | 39 | private final int value; 40 | private static final Map MAP = new HashMap(7); 41 | static { 42 | for(VideoFormat v : VideoFormat.values()) { 43 | MAP.put(v.intValue(), v); 44 | } 45 | } 46 | 47 | private VideoFormat(int value) { 48 | this.value = value; 49 | } 50 | 51 | public int intValue() { 52 | return value; 53 | } 54 | 55 | public static VideoFormat fromInt(int value) { 56 | return MAP.get(value); 57 | } 58 | } -------------------------------------------------------------------------------- /fakenect/fakenect-record.1: -------------------------------------------------------------------------------- 1 | .TH FAKENECT-RECORD 1 2012-01-29 "libfreenect" "libfreenect manual" 2 | .SH NAME 3 | fakenect-record - program to save dumps from kinect to file 4 | .SH SYNOPSIS 5 | .SY fakenect-record 6 | .OP \-h 7 | .OP \-ffmpeg 8 | .OP \-ffmpeg-opts \fIoptions\fP 9 | .I outputdir 10 | .br 11 | .SH DESCRIPTION 12 | .LP 13 | \fBfakenect-record\fP dumps the output of the kinect in \fIoutputdir\fP 14 | folder. It saves the acceleration, depth, and rgb data as individual files 15 | with names in the form "TYPE-CURRENTIME-TIMESTAMP" where: 16 | .IP " *" 3 17 | TYPE is either (a)ccel, (d)epth, or (r)gb 18 | .IP " *" 3 19 | TIMESTAMP corresponds to the timestamp associated with the observation (or 20 | in the case of accel, the last timestamp seen) 21 | .IP " *" 3 22 | CURRENTTIME corresponds to a floating point version of the time in seconds. 23 | .LP 24 | The purpose of storing the current time is so that delays can 25 | be recreated exactly as they occurred. For RGB and DEPTH the dump is just 26 | the entirety of the data provided in PPM and PGM formats respectively (just 27 | a 1 line header above the raw dump). For ACCEL, the dump is the 28 | "freenect_raw_tilt_state". Only the front part of the file name is used, 29 | with the rest left undefined (extension, extra info, etc). 30 | .LP 31 | A file called INDEX.txt is also output with all of the filenames local to 32 | that directory to simplify the format (e.g., no need to read the directory 33 | structure). 34 | .LP 35 | Once started, the program will continue to acquire data from the kinect. 36 | When you want to stop it, hit Ctrl-C and the signal will be caught, runloop 37 | stopped, and everything will be stored cleanly. 38 | .SH OPTIONS 39 | .TP 40 | .B \-ffmpeg 41 | If present, send the the video stream to ffmpeg 42 | . 43 | .TP 44 | .B \-ffmpeg-opts \fIoptions\fP 45 | When using ffmpeg, specify the options to be used with it. If unspecified, 46 | it will use the options "\-aspect 4:3 \-r 20 \-vcodec msmpeg4 \-b 30000k" 47 | . 48 | .TP 49 | .B \-h 50 | Display the command-line help 51 | .SH "SEE ALSO" 52 | .BR fakenect (1) 53 | 54 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/ConsoleTest/VS2010/ConsoleTest.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C# Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "ConsoleTest.csproj", "{D5CAFFD9-EC8B-4A16-80C9-48048C85843A}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|Mixed Platforms = Debug|Mixed Platforms 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|Mixed Platforms = Release|Mixed Platforms 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|Any CPU.ActiveCfg = Debug|x86 19 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 20 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|Mixed Platforms.Build.0 = Debug|x86 21 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|x64.ActiveCfg = Debug|x64 22 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|x64.Build.0 = Debug|x64 23 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|x86.ActiveCfg = Debug|x86 24 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Debug|x86.Build.0 = Debug|x86 25 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|Any CPU.ActiveCfg = Release|x86 26 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|Mixed Platforms.ActiveCfg = Release|x86 27 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|x64.ActiveCfg = Release|x64 28 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|x64.Build.0 = Release|x64 29 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|x86.ActiveCfg = Release|x86 30 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A}.Release|x86.Build.0 = Release|x86 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | GlobalSection(MonoDevelopProperties) = preSolution 36 | StartupItem = ConsoleTest.csproj 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/spec/context_spec.rb: -------------------------------------------------------------------------------- 1 | 2 | require 'spec_helper' 3 | 4 | describe Freenect::Context do 5 | before(:all) { @ctx = Freenect::Context.new() } 6 | after(:all) { @ctx.close if @ctx } 7 | 8 | it "should initialize a context" do 9 | @ctx.should be_kind_of(Freenect::Context) 10 | end 11 | 12 | it "should indicate the number of devices attached" do 13 | @ctx.num_devices.should >= 0 14 | end 15 | 16 | it "should open a device when one is connected" do 17 | if @ctx.num_devices > 0 18 | dev = @ctx[0] 19 | dev.should be_kind_of(Freenect::Device) 20 | lambda { dev.close }.should_not raise_error 21 | end 22 | end 23 | 24 | it "should raise an exception when an invalid device index is opened" do 25 | lambda { @ctx[@ctx.num_devices + 1] }.should raise_error(StandardError) 26 | lambda { @ctx.open_device(@ctx.num_devices + 1) }.should raise_error(StandardError) 27 | end 28 | 29 | it "should allow a libfreenect log level to be set using symbols or constants" do 30 | (@ctx.log_level = :fatal).should == :fatal 31 | (@ctx.log_level = Freenect::LOG_FATAL).should == 0 32 | 33 | (@ctx.log_level = :error).should == :error 34 | (@ctx.log_level = Freenect::LOG_ERROR).should == 1 35 | 36 | (@ctx.log_level = :warning).should == :warning 37 | (@ctx.log_level = Freenect::LOG_WARNING).should == 2 38 | 39 | (@ctx.log_level = :notice).should == :notice 40 | (@ctx.log_level = Freenect::LOG_NOTICE).should == 3 41 | 42 | (@ctx.log_level = :info).should == :info 43 | (@ctx.log_level = Freenect::LOG_INFO).should == 4 44 | 45 | (@ctx.log_level = :debug).should == :debug 46 | (@ctx.log_level = Freenect::LOG_DEBUG).should == 5 47 | 48 | (@ctx.log_level = :spew).should == :spew 49 | (@ctx.log_level = Freenect::LOG_SPEW).should == 6 50 | 51 | (@ctx.log_level = :flood).should == :flood 52 | (@ctx.log_level = Freenect::LOG_FLOOD).should == 7 53 | end 54 | 55 | it "should allow a log callback to be set" do 56 | @ctx.set_log_callback {|a,b,c| p [a,b,c] } 57 | end 58 | 59 | 60 | end 61 | 62 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/ImageMap.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | using System; 28 | using System.Collections.Generic; 29 | using System.Drawing; 30 | using System.Runtime.InteropServices; 31 | 32 | namespace freenect 33 | { 34 | /// 35 | /// Represents a map of rgb values from the RGBCamera 36 | /// 37 | public class ImageMap : BaseDataMap 38 | { 39 | /// 40 | /// Constructor #1 41 | /// 42 | /// 43 | /// A 44 | /// 45 | public ImageMap(FrameMode mode) : base(mode) 46 | { 47 | 48 | } 49 | 50 | /// 51 | /// Constructor #2 52 | /// 53 | /// 54 | /// A 55 | /// 56 | /// 57 | /// A 58 | /// 59 | public ImageMap(FrameMode mode, IntPtr buffer) : base(mode, buffer) 60 | { 61 | 62 | } 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /fakenect/fakenect.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This file is part of the OpenKinect Project. http://www.openkinect.org 4 | # 5 | # Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 6 | # for details. 7 | # 8 | # This code is licensed to you under the terms of the Apache License, version 9 | # 2.0, or, at your option, the terms of the GNU General Public License, 10 | # version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 11 | # or the following URLs: 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # http://www.gnu.org/licenses/gpl-2.0.txt 14 | # 15 | # If you redistribute this file in source form, modified or unmodified, 16 | # you may: 17 | # 1) Leave this header intact and distribute it under the same terms, 18 | # accompanying it with the APACHE20 and GPL20 files, or 19 | # 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 20 | # 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 21 | # In all cases you must keep the copyright notice intact and include a copy 22 | # of the CONTRIB file. 23 | # Binary distributions must follow the binary distribution requirements of 24 | # either License. 25 | 26 | # fakenect wrapper script: 27 | # simplifies calling libfreenect applications under fakenect 28 | # by taking the fakenect database, app to run, and its args 29 | # then filling out the necessary environment variables and calling the app 30 | # usage: fakenect /path/to/fakenect/dump app --arg=value 31 | 32 | # catch bad args 33 | if [ $# -lt 2 ] 34 | then 35 | echo "Usage: $0 " 36 | exit -1 37 | fi 38 | 39 | # set path to fakenect database 40 | export FAKENECT_PATH=$1 41 | 42 | # set link path (LD_LIBRARY_PATH for Linux, DYLIB_LIBRARY_PATH for OS X) 43 | if [ `uname` == "Darwin" ]; 44 | then 45 | export DYLD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@PROJECT_LIBRARY_INSTALL_DIR@/fakenect/:${DYLD_LIBRARY_PATH}" 46 | else 47 | export LD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/@PROJECT_LIBRARY_INSTALL_DIR@/fakenect/:${LD_LIBRARY_PATH}" 48 | fi 49 | 50 | # run desired app w/ args, now that environment is configured 51 | "${@:2}" 52 | -------------------------------------------------------------------------------- /wrappers/python/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from distutils.core import setup 3 | from distutils.extension import Extension 4 | import re 5 | import numpy as np 6 | 7 | 8 | def get_cython_version(): 9 | """ 10 | Returns: 11 | Version as a pair of ints (major, minor) 12 | 13 | Raises: 14 | ImportError: Can't load cython or find version 15 | """ 16 | import Cython.Compiler.Main 17 | 18 | try: 19 | # old way, fails for me 20 | version = Cython.Compiler.Main.Version.version 21 | except AttributeError: 22 | version = Cython.Compiler.Main.version 23 | 24 | match = re.search('^([0-9]+)\.([0-9]+)', version) 25 | try: 26 | return [int(g) for g in match.groups()] 27 | except AttributeError: 28 | raise ImportError 29 | 30 | # Only use Cython if it is available, else just use the pre-generated files 31 | try: 32 | cython_version = get_cython_version() 33 | # Requires Cython version 0.13 and up 34 | if cython_version[0] == 0 and cython_version[1] < 13: 35 | raise ImportError 36 | from Cython.Distutils import build_ext 37 | source_ext = '.pyx' 38 | cmdclass = {'build_ext': build_ext} 39 | except ImportError: 40 | source_ext = '.c' 41 | cmdclass = {} 42 | 43 | 44 | ext_modules = [Extension("freenect", ["freenect" + source_ext], 45 | libraries=['usb-1.0', 'freenect', 'freenect_sync'], 46 | runtime_library_dirs=['/usr/local/lib', 47 | '/usr/local/lib64', 48 | '/usr/lib/'], 49 | extra_compile_args=['-fPIC', '-I', '../../include/', 50 | '-I', '/usr/include/libusb-1.0/', 51 | '-I', '/usr/local/include/libusb-1.0', 52 | '-I', '/usr/local/include', 53 | '-I', '../c_sync/', 54 | '-I', np.get_include()])] 55 | setup(name='freenect', 56 | cmdclass=cmdclass, 57 | ext_modules=ext_modules) 58 | -------------------------------------------------------------------------------- /cmake_modules/FindOS.cmake: -------------------------------------------------------------------------------- 1 | # Check the OS type. 2 | 3 | # CMake does not distinguish Linux from other Unices. 4 | STRING (REGEX MATCH "Linux" PROJECT_OS_LINUX ${CMAKE_SYSTEM_NAME}) 5 | # Nor *BSD 6 | STRING (REGEX MATCH "BSD" PROJECT_OS_BSD ${CMAKE_SYSTEM_NAME}) 7 | # Or Solaris. I'm seeing a trend, here 8 | STRING (REGEX MATCH "SunOS" PROJECT_OS_SOLARIS ${CMAKE_SYSTEM_NAME}) 9 | 10 | # Windows is easy (for once) 11 | IF (WIN32) 12 | SET (PROJECT_OS_WIN TRUE BOOL INTERNAL) 13 | ENDIF (WIN32) 14 | 15 | # Check if it's an Apple OS 16 | IF (APPLE) 17 | # Check if it's OS X or another MacOS (that's got to be pretty unlikely) 18 | STRING (REGEX MATCH "Darwin" PROJECT_OS_OSX ${CMAKE_SYSTEM_NAME}) 19 | IF (NOT PROJECT_OS_OSX) 20 | SET (PROJECT_OS_MACOS TRUE BOOL INTERNAL) 21 | ENDIF (NOT PROJECT_OS_OSX) 22 | ENDIF (APPLE) 23 | 24 | # QNX 25 | IF (QNXNTO) 26 | SET (PROJECT_OS_QNX TRUE BOOL INTERNAL) 27 | ENDIF (QNXNTO) 28 | 29 | IF (PROJECT_OS_LINUX) 30 | MESSAGE (STATUS "Operating system is Linux") 31 | ELSEIF (PROJECT_OS_BSD) 32 | MESSAGE (STATUS "Operating system is BSD") 33 | ELSEIF (PROJECT_OS_WIN) 34 | MESSAGE (STATUS "Operating system is Windows") 35 | ELSEIF (PROJECT_OS_OSX) 36 | MESSAGE (STATUS "Operating system is Apple MacOS X") 37 | ELSEIF (PROJECT_OS_MACOS) 38 | MESSAGE (STATUS "Operating system is Apple MacOS (not OS X)") 39 | ELSEIF (PROJECT_OS_QNX) 40 | MESSAGE (STATUS "Operating system is QNX") 41 | ELSEIF (PROJECT_OS_SOLARIS) 42 | MESSAGE (STATUS "Operating system is Solaris") 43 | ELSE (PROJECT_OS_LINUX) 44 | MESSAGE (STATUS "Operating system is generic Unix") 45 | ENDIF (PROJECT_OS_LINUX) 46 | 47 | MESSAGE (STATUS "Got System Processor ${CMAKE_SYSTEM_PROCESSOR}") 48 | 49 | # 32 or 64 bit Linux 50 | IF (PROJECT_OS_LINUX) 51 | # Set the library directory suffix accordingly 52 | IF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") 53 | SET (PROJECT_PROC_64BIT TRUE BOOL INTERNAL) 54 | MESSAGE (STATUS "Linux x86_64 Detected") 55 | ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64") 56 | MESSAGE (STATUS "Linux ppc64 Detected") 57 | SET (PROJECT_PROC_64BIT TRUE BOOL INTERNAL) 58 | ENDIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") 59 | ENDIF (PROJECT_OS_LINUX) 60 | -------------------------------------------------------------------------------- /wrappers/actionscript/server/freenect_network.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | #include 35 | #ifndef _WIN32 36 | #include 37 | #include 38 | #else 39 | #include 40 | #include 41 | #pragma comment(lib, "Ws2_32.lib") 42 | #include 43 | #include 44 | #endif 45 | #include 46 | #include 47 | #include 48 | 49 | typedef void (*callback)(void); 50 | int freenect_network_init(callback cb); 51 | void freenect_network_close(); 52 | void freenect_network_read(char *buff, int *len); 53 | int freenect_network_sendMessage(int first, int second, unsigned char *data, int len); 54 | void freenect_network_wait(); 55 | #ifdef _WIN32 56 | int freenect_network_initSocket(struct addrinfo si_type, PCSTR conf_port, SOCKET *the_socket); 57 | #else 58 | int freenect_network_initSocket(struct sockaddr_in si_type, int conf_port, int *the_socket); 59 | #endif 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/KinectDemo/PreviewControl.UI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Windows.Forms; 30 | using freenect; 31 | using OpenTK; 32 | using OpenTK.Graphics.OpenGL; 33 | using System.Drawing; 34 | 35 | namespace KinectDemo 36 | { 37 | /// 38 | /// Displays video / depth data 39 | /// 40 | public partial class PreviewControl : UserControl 41 | { 42 | 43 | /// 44 | /// Initialize UI components 45 | /// 46 | public void InitializeComponents() 47 | { 48 | /// 49 | /// renderPanel 50 | /// 51 | this.renderPanel = new OpenTK.GLControl(); 52 | this.renderPanel.Dock = DockStyle.Fill; 53 | this.renderPanel.Load += HandleRenderPanelLoad; 54 | this.renderPanel.Paint += HandleRenderPanelPaint; 55 | 56 | /// 57 | /// PreviewWindow 58 | /// 59 | this.BackColor = Color.Blue; 60 | this.Controls.Add(this.renderPanel); 61 | } 62 | 63 | /// 64 | /// UI Components 65 | /// 66 | protected OpenTK.GLControl renderPanel; 67 | 68 | } 69 | } -------------------------------------------------------------------------------- /wrappers/actionscript/server/as3_jpeg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #include "as3_jpeg.h" 28 | 29 | /* 30 | * Compress RGB buffer in memory 31 | */ 32 | int RGB_2_JPEG(unsigned char *buffer, unsigned char **compressed, long unsigned int *new_len, int quality) { 33 | struct jpeg_compress_struct cinfo = {0}; 34 | struct jpeg_error_mgr jerr; 35 | JSAMPROW row_ptr[1]; 36 | int row_stride; 37 | 38 | *compressed = NULL; 39 | *new_len = 0; 40 | 41 | cinfo.err = jpeg_std_error(&jerr); 42 | jpeg_create_compress(&cinfo); 43 | jpeg_mem_dest(&cinfo, compressed, new_len); 44 | 45 | cinfo.image_width = 640; 46 | cinfo.image_height = 480; 47 | cinfo.input_components = 3; 48 | cinfo.in_color_space = JCS_RGB; 49 | 50 | jpeg_set_defaults(&cinfo); 51 | jpeg_set_quality(&cinfo, quality, TRUE); 52 | jpeg_start_compress(&cinfo, TRUE); 53 | row_stride = 640 * 3; 54 | 55 | while (cinfo.next_scanline < cinfo.image_height) { 56 | row_ptr[0] = &buffer[cinfo.next_scanline * row_stride]; 57 | jpeg_write_scanlines(&cinfo, row_ptr, 1); 58 | } 59 | 60 | jpeg_finish_compress(&cinfo); 61 | jpeg_destroy_compress(&cinfo); 62 | 63 | return 1; 64 | } -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/Linux-Arm/OniPlatformLinux-Arm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_PLATFORM_LINUX_ARM_H_ 22 | #define _ONI_PLATFORM_LINUX_ARM_H_ 23 | 24 | // Start with Linux-x86, and override what's different 25 | #include "../Linux-x86/OniPlatformLinux-x86.h" 26 | 27 | //--------------------------------------------------------------------------- 28 | // Platform Basic Definition 29 | //--------------------------------------------------------------------------- 30 | #undef ONI_PLATFORM 31 | #undef ONI_PLATFORM_STRING 32 | #define ONI_PLATFORM ONI_PLATFORM_LINUX_ARM 33 | #define ONI_PLATFORM_STRING "Linux-Arm" 34 | 35 | #endif //_ONI_PLATFORM_LINUX_ARM_H_ 36 | 37 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/src/Utility.hpp: -------------------------------------------------------------------------------- 1 | // This file contains symbols that may be used by any class or don't really go anywhere else. 2 | #pragma once 3 | 4 | #include 5 | #include "Driver/OniDriverAPI.h" 6 | 7 | 8 | // Oni helpers 9 | 10 | static OniVideoMode makeOniVideoMode(OniPixelFormat pixel_format, int resolution_x, int resolution_y, int frames_per_second) 11 | { 12 | OniVideoMode mode; 13 | mode.pixelFormat = pixel_format; 14 | mode.resolutionX = resolution_x; 15 | mode.resolutionY = resolution_y; 16 | mode.fps = frames_per_second; 17 | return mode; 18 | } 19 | static bool operator==(const OniVideoMode& left, const OniVideoMode& right) 20 | { 21 | return (left.pixelFormat == right.pixelFormat && left.resolutionX == right.resolutionX 22 | && left.resolutionY == right.resolutionY && left.fps == right.fps); 23 | } 24 | static bool operator<(const OniVideoMode& left, const OniVideoMode& right) 25 | { 26 | return (left.resolutionX * left.resolutionY < right.resolutionX * right.resolutionY); 27 | } 28 | 29 | static bool operator<(const OniDeviceInfo& left, const OniDeviceInfo& right) 30 | { 31 | return (strcmp(left.uri, right.uri) < 0); 32 | } 33 | 34 | 35 | /// Extracts `first` from `pair`, for transforming a map into its keys. 36 | struct ExtractKey 37 | { 38 | template typename T::first_type 39 | operator()(T pair) const 40 | { 41 | return pair.first; 42 | } 43 | }; 44 | 45 | 46 | // holding out on C++11 47 | template 48 | static std::string to_string(const T& n) 49 | { 50 | std::ostringstream oss; 51 | oss << n; 52 | return oss.str(); 53 | } 54 | 55 | 56 | // global logging 57 | namespace FreenectDriver 58 | { 59 | static void WriteMessage(std::string info) 60 | { 61 | std::cout << "OpenNI2-FreenectDriver: " << info << std::endl; 62 | } 63 | 64 | // DriverServices is set in DeviceDriver.cpp so all files can call errorLoggerAppend() 65 | static oni::driver::DriverServices* DriverServices; 66 | static void LogError(std::string error) 67 | { 68 | // errorLoggerAppend() doesn't seem to go anywhere, so WriteMessage also 69 | WriteMessage("(ERROR) " + error); 70 | 71 | if (DriverServices != NULL) 72 | DriverServices->errorLoggerAppend(std::string("OpenNI2-FreenectDriver: " + error).c_str()); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /platform/windows/libusb10emu/libusb-1.0/libusbemu_threads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | // Wrappers for platform-specific thread/synchronization objects: 30 | // * Thread 31 | // * Mutex (Critical Section) 32 | // * Events (Conditional Variables) 33 | 34 | #ifdef WIN32 35 | // stick to the Windows scheme for now, but this structure could be easily 36 | // replaced by pthread for portability; however if real-time priority turns 37 | // out to be a requirement on that platform, the pthread implementation may 38 | // not have support for such scheduling. 39 | // for a much more lightweight run-time, this could be replaced by dummy 40 | // objects, provided that the library client is careful enough to avoid any 41 | // sort of race-conditions or dead-locks... 42 | #include "libusbemu_threads_win32.h" 43 | #else 44 | #error LIBUSBEMU PTHREAD WRAPPER NOT YET IMPLEMENTED! 45 | // #include "libusbemu_threads_pthread.h" 46 | #endif 47 | 48 | namespace libusbemu 49 | { 50 | 51 | struct RAIIMutex 52 | { 53 | QuickMutex& m_mutex; 54 | RAIIMutex(QuickMutex& mutex) : m_mutex(mutex) { m_mutex.Enter(); } 55 | ~RAIIMutex() { m_mutex.Leave(); } 56 | }; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/ConsoleTest/VS2008/ConsoleTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 9.0.21022 7 | 2.0 8 | {D5CAFFD9-EC8B-4A16-80C9-48048C85843A} 9 | Exe 10 | ConsoleTest 11 | ConsoleTest 12 | v3.5 13 | 14 | 15 | true 16 | full 17 | false 18 | ..\..\..\..\bin\ 19 | DEBUG 20 | prompt 21 | 4 22 | x86 23 | true 24 | 25 | 26 | none 27 | false 28 | ..\..\..\..\bin\ 29 | prompt 30 | 4 31 | x86 32 | true 33 | 34 | 35 | 36 | 37 | False 38 | ..\..\..\..\bin\freenectdotnet.dll 39 | 40 | 41 | 42 | 43 | 44 | AssemblyInfo.cs 45 | 46 | 47 | Main.cs 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /wrappers/csharp/src/test/KinectDemo/VS2010/KinectDemo.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C# Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KinectDemo", "KinectDemo.csproj", "{2EBB5F0B-9C65-4777-8B0C-76A83867C650}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|Mixed Platforms = Debug|Mixed Platforms 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|Mixed Platforms = Release|Mixed Platforms 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|Any CPU.ActiveCfg = Debug|x86 19 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|Any CPU.Build.0 = Debug|x86 20 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 21 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|Mixed Platforms.Build.0 = Debug|x86 22 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|x64.ActiveCfg = Debug|x64 23 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|x64.Build.0 = Debug|x64 24 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|x86.ActiveCfg = Debug|x86 25 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Debug|x86.Build.0 = Debug|x86 26 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|Any CPU.ActiveCfg = Release|x86 27 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|Any CPU.Build.0 = Release|x86 28 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|Mixed Platforms.ActiveCfg = Release|x86 29 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|Mixed Platforms.Build.0 = Release|x86 30 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|x64.ActiveCfg = Release|x64 31 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|x64.Build.0 = Release|x64 32 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|x86.ActiveCfg = Release|x86 33 | {2EBB5F0B-9C65-4777-8B0C-76A83867C650}.Release|x86.Build.0 = Release|x86 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | GlobalSection(MonoDevelopProperties) = preSolution 39 | StartupItem = KinectDemo.csproj 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/MacOSX/OniPlatformMacOSX.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * PrimeSense PSCommon Library * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of PSCommon. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_PLATFORM_MACOSX_H_ 22 | #define _ONI_PLATFORM_MACOSX_H_ 23 | 24 | // Start with Linux-x86, and override what's different 25 | #include "../Linux-x86/OniPlatformLinux-x86.h" 26 | 27 | #include 28 | 29 | #undef ONI_PLATFORM 30 | #undef ONI_PLATFORM_STRING 31 | #define ONI_PLATFORM ONI_PLATFORM_MACOSX 32 | #define ONI_PLATFORM_STRING "MacOSX" 33 | 34 | #define ONI_PLATFORM_HAS_NO_TIMED_OPS 35 | #define ONI_PLATFORM_HAS_NO_CLOCK_GETTIME 36 | #define ONI_PLATFORM_HAS_NO_SCHED_PARAM 37 | #define ONI_PLATFORM_HAS_BUILTIN_SEMUN 38 | 39 | #undef ONI_THREAD_STATIC 40 | #define ONI_THREAD_STATIC 41 | 42 | #endif //_ONI_PLATFORM_MACOSX_H_ 43 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/examples/record.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This is a more or less a straight ruby port of the "record" utility 3 | # included in the libfreenect fakenect directory using the 4 | # ffi-libfreenect ruby class wrappers. 5 | # 6 | # This was really implemented just to see if ffi-libfreenect was working. 7 | # However, the output should be completely compatible the C version fakenect. 8 | # 9 | # usage: record.rb output_dir 10 | # 11 | 12 | begin 13 | require 'rubygems' 14 | rescue LoadError 15 | end 16 | 17 | $: << File.expand_path(File.join(File.dirname(__FILE__), "../lib")) 18 | require 'freenect' 19 | 20 | $last_timestamp = 0 21 | $record_running = true 22 | 23 | def open_dump(type, timestamp, extension) 24 | $last_timestamp = timestamp 25 | filename = "%s-%f-%u.%s" % [ type, Time.now.to_f, timestamp, extension] 26 | STDERR.puts "Writing: #{File.join($out_dir, filename)}" 27 | File.open(File.join($out_dir,"INDEX.txt"), "a"){|f| f.puts(filename) } 28 | File.open(File.join($out_dir, filename), "wb") {|f| yield f} 29 | end 30 | 31 | orig_dir = Dir.pwd 32 | unless $out_dir = ARGV.shift 33 | STDERR.puts "usage: #{File.basename $0} output_dir" 34 | exit 1 35 | end 36 | Dir.mkdir($out_dir) unless File.directory?($out_dir) 37 | 38 | trap('INT') do 39 | STDERR.puts "Caught INT signal cleaning up" 40 | $record_running = false 41 | end 42 | 43 | ctx = Freenect.init() 44 | dev = ctx.open_device(0) 45 | 46 | dev.depth_mode = Freenect.depth_mode(:medium, :depth_11bit) 47 | dev.video_mode = Freenect.video_mode(:medium, :rgb) 48 | dev.start_depth() 49 | dev.start_video() 50 | 51 | dev.set_depth_callback do |device, depth, timestamp| 52 | open_dump('d', timestamp, "pgm") do |f| 53 | f.puts("P5 %d %d 65535\n" % [ dev.depth_mode.width, dev.depth_mode.height ] ) 54 | f.write(depth.read_string_length(dev.depth_mode.bytes)) 55 | end 56 | end 57 | 58 | dev.set_video_callback do |device, video, timestamp| 59 | open_dump('r', timestamp, 'ppm') do |f| 60 | f.puts("P6 %d %d 255\n" % [ dev.video_mode.width, dev.video_mode.height ] ) 61 | f.write(video.read_string_length(dev.video_mode.bytes)) 62 | end 63 | end 64 | 65 | while $record_running and (ctx.process_events >= 0) 66 | open_dump('a', $last_timestamp, "dump") do |f| 67 | state = dev.get_tilt_state 68 | f.write(state.to_ptr.read_string_length(state.size)) 69 | end 70 | end 71 | 72 | Dir.chdir(orig_dir) 73 | dev.stop_depth 74 | dev.stop_video 75 | dev.close 76 | ctx.close 77 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # Build for main library 3 | ###################################################################################### 4 | 5 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 6 | include_directories(${LIBUSB_1_INCLUDE_DIRS}) 7 | 8 | # Audio Firmware 9 | include(FindPythonInterp) 10 | IF(BUILD_REDIST_PACKAGE) 11 | # If this build is intended for a redistributable package, we can't include audios.bin, so we should include fwfetcher.py 12 | # and the package should run "python fwfetcher.py $INSTALL_PREFIX/share" as a postinst hook 13 | install (FILES "fwfetcher.py" DESTINATION "${CMAKE_INSTALL_PREFIX}/share") 14 | ELSE(BUILD_REDIST_PACKAGE) 15 | # If the install is local only, we can just run fwfetcher.py and install the audios.bin firmware to the system folder 16 | add_custom_target(firmware ALL 17 | COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/fwfetcher.py" "../audios.bin" 18 | DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/fwfetcher.py") 19 | install (FILES "${CMAKE_CURRENT_BINARY_DIR}/../audios.bin" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/libfreenect") 20 | ENDIF() 21 | 22 | LIST(APPEND SRC core.c tilt.c cameras.c flags.c usb_libusb10.c registration.c audio.c loader.c) 23 | 24 | add_library (freenect SHARED ${SRC}) 25 | set_target_properties ( freenect PROPERTIES 26 | VERSION ${PROJECT_VER} 27 | SOVERSION ${PROJECT_APIVER}) 28 | install (TARGETS freenect 29 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}") 30 | 31 | add_library (freenectstatic STATIC ${SRC}) 32 | set_target_properties (freenectstatic PROPERTIES OUTPUT_NAME freenect) 33 | IF(UNIX AND NOT APPLE) 34 | SET_TARGET_PROPERTIES (freenectstatic PROPERTIES COMPILE_FLAGS "-fPIC") 35 | ENDIF() 36 | install (TARGETS freenectstatic 37 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}") 38 | 39 | target_link_libraries (freenect ${LIBUSB_1_LIBRARIES}) 40 | target_link_libraries (freenectstatic ${LIBUSB_1_LIBRARIES}) 41 | 42 | # Install the header files 43 | install (FILES "../include/libfreenect.h" "../include/libfreenect_registration.h" "../include/libfreenect_audio.h" 44 | DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}) 45 | 46 | IF(UNIX) 47 | # Produce a pkg-config file for linking against the shared lib 48 | configure_file ("libfreenect.pc.in" "libfreenect.pc" @ONLY) 49 | install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libfreenect.pc" 50 | DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}/pkgconfig") 51 | ENDIF() 52 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/README.rdoc: -------------------------------------------------------------------------------- 1 | = ffi-libfreenect 2 | 3 | FFI-based Ruby wrapper for the OpenKinect libfreenect library. 4 | 5 | == Requirements 6 | * ffi >= 0.5.0 7 | 8 | == Installation 9 | 10 | === via Gem 11 | 12 | (sudo)? gem install ffi-libfreenect 13 | 14 | === via Rake 15 | 16 | git clone http://github.com/jgrunzweig/ffi-libfreenect.git 17 | cd ffi-libfreenect 18 | (sudo)? gem install jeweler 19 | rake install 20 | 21 | === Synopsis 22 | 23 | require 'freenect' 24 | 25 | ctx = Freenect.init() 26 | devs = ctx.num_devices 27 | 28 | STDERR.puts "Number of Kinects detected: #{devs}" 29 | unless devs > 0 30 | STDERR.puts "Error: no kinect detected" 31 | exit 1 32 | end 33 | 34 | STDERR.puts "Selecting device 0" 35 | dev = ctx.open_device(0) 36 | 37 | dev.set_led(:red) # play with the led 38 | dev.set_tilt_degrees(30) # tilt up to max 39 | sleep 1 40 | dev.set_tilt_degrees(-30) # tilt down to max 41 | sleep 1 42 | dev.set_tilt_degrees(0.0) # tilt back to center 43 | sleep 1 44 | dev.set_led(:green) # play with the led 45 | 46 | # Actual video and depth capture work similarly to eachother. 47 | # But they're still both pretty un-sugary. 48 | # 49 | # Future versions will probably abstract this and try to make it more 50 | # ruby-ish. 51 | # 52 | # The example below shows how to write a single video frame to a PPM file. 53 | 54 | dev.depth_mode = Freenect.depth_mode(:medium, :depth_11bit) 55 | dev.video_mode = Freenect.video_mode(:medium, :rgb) 56 | dev.start_depth() 57 | dev.start_video() 58 | 59 | $snapshot_finished = nil 60 | 61 | STDERR.puts "Taking snapshot" 62 | dev.set_video_callback do |device, video, timestamp| 63 | if not $snapshot_finished 64 | fname = "%u.ppm" % timestamp 65 | STDERR.puts "Writing #{fname}" 66 | File.open(fname, "w") do |f| 67 | f.puts("P6 %d %d 255\n" % [ dev.video_mode.width, dev.video_mode.height ] ) 68 | f.write(video.read_string_length(dev.video_mode.bytes)) 69 | end 70 | $snapshot_finished = true 71 | end 72 | end 73 | 74 | until $snapshot_finished 75 | break if (ctx.process_events < 0) 76 | end 77 | 78 | dev.set_led(:off) 79 | dev.stop_depth 80 | dev.stop_video 81 | dev.close 82 | ctx.close 83 | 84 | == Copyright 85 | 86 | Copyright (c) 2010 Josh Grunzweig & Eric Monti. See LICENSE.txt for details. 87 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/util/Jdk14LogHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect.util; 26 | 27 | import org.openkinect.freenect.Device; 28 | import org.openkinect.freenect.LogHandler; 29 | import org.openkinect.freenect.LogLevel; 30 | 31 | import java.util.EnumMap; 32 | import java.util.logging.Level; 33 | import java.util.logging.Logger; 34 | 35 | public class Jdk14LogHandler implements LogHandler { 36 | 37 | private final Logger logger = Logger.getLogger("freenect"); 38 | private final EnumMap levelMap = new EnumMap(LogLevel.class); 39 | 40 | public Jdk14LogHandler() { 41 | logger.setLevel(Level.ALL); 42 | levelMap.put(LogLevel.FATAL, Level.SEVERE); 43 | levelMap.put(LogLevel.ERROR, Level.SEVERE); 44 | levelMap.put(LogLevel.WARNING, Level.WARNING); 45 | levelMap.put(LogLevel.NOTICE, Level.CONFIG); 46 | levelMap.put(LogLevel.INFO, Level.INFO); 47 | levelMap.put(LogLevel.DEBUG, Level.FINE); 48 | levelMap.put(LogLevel.SPEW, Level.FINER); 49 | levelMap.put(LogLevel.FLOOD, Level.FINEST); 50 | } 51 | 52 | @Override 53 | public void onMessage(Device dev, LogLevel level, String msg) { 54 | logger.log(levelMap.get(level), "device " + dev.getDeviceIndex() + ": " + msg); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /fakenect/platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 Brandyn White (bwhite@dappervision.com) 5 | * 6 | * This code is licensed to you under the terms of the Apache License, version 7 | * 2.0, or, at your option, the terms of the GNU General Public License, 8 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 9 | * or the following URLs: 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * http://www.gnu.org/licenses/gpl-2.0.txt 12 | * 13 | * If you redistribute this file in source form, modified or unmodified, you 14 | * may: 15 | * 1) Leave this header intact and distribute it under the same terms, 16 | * accompanying it with the APACHE20 and GPL20 files, or 17 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 18 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 19 | * In all cases you must keep the copyright notice intact and include a copy 20 | * of the CONTRIB file. 21 | * 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | #pragma once 26 | 27 | #include 28 | #ifdef _WIN32 29 | #include 30 | #include 31 | #if defined(_MSC_VER) && _MSC_VER < 1900 32 | #define snprintf _snprintf 33 | #endif 34 | #define popen _popen 35 | #else 36 | #include 37 | #include 38 | #endif 39 | 40 | 41 | double get_time() 42 | { 43 | #ifdef _WIN32 44 | SYSTEMTIME st; 45 | GetSystemTime(&st); 46 | FILETIME ft; 47 | SystemTimeToFileTime(&st, &ft); 48 | ULARGE_INTEGER li; 49 | li.LowPart = ft.dwLowDateTime; 50 | li.HighPart = ft.dwHighDateTime; 51 | // FILETIME is given as a 64-bit value for the number of 100-nanosecond 52 | // intervals that have passed since Jan 1, 1601 (UTC). The difference between that 53 | // epoch and the POSIX epoch (Jan 1, 1970) is 116444736000000000 such ticks. 54 | uint64_t total_usecs = (li.QuadPart - 116444736000000000L) / 10L; 55 | return (total_usecs / 1000000.); 56 | #else 57 | struct timeval cur; 58 | gettimeofday(&cur, NULL); 59 | return cur.tv_sec + cur.tv_usec / 1000000.; 60 | #endif 61 | } 62 | 63 | void sleep_highres(double tm) 64 | { 65 | #ifdef _WIN32 66 | int msec = floor(tm * 1000); 67 | if (msec > 0) { 68 | Sleep(msec); 69 | } 70 | #else 71 | int sec = floor(tm); 72 | int usec = (tm - sec) * 1000000; 73 | if (tm > 0) { 74 | sleep(sec); 75 | usleep(usec); 76 | } 77 | #endif 78 | } 79 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/Android-Arm/OniPlatformAndroid-Arm.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_PLATFORM_ANDROID_ARM_H_ 22 | #define _ONI_PLATFORM_ANDROID_ARM_H_ 23 | 24 | // Start with Linux-x86, and override what's different 25 | #include "../Linux-x86/OniPlatformLinux-x86.h" 26 | 27 | //--------------------------------------------------------------------------- 28 | // Platform Basic Definition 29 | //--------------------------------------------------------------------------- 30 | #undef ONI_PLATFORM 31 | #undef ONI_PLATFORM_STRING 32 | 33 | #define ONI_PLATFORM ONI_PLATFORM_ANDROID_ARM 34 | #define ONI_PLATFORM_STRING "Android-Arm" 35 | 36 | #ifdef HAVE_ANDROID_OS 37 | #define ONI_PLATFORM_ANDROID_OS 38 | 39 | #undef ONI_PLATFORM_STRING 40 | #define ONI_PLATFORM_STRING "AndroidOS-Arm" 41 | #endif 42 | 43 | #endif //_ONI_PLATFORM_LINUX_ARM_H_ 44 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/DepthFrameMode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | using System; 28 | using System.Drawing; 29 | using System.Drawing.Imaging; 30 | using System.Runtime.InteropServices; 31 | using System.Collections.Generic; 32 | 33 | namespace freenect 34 | { 35 | /// 36 | /// Depth frame mode. 37 | /// 38 | public class DepthFrameMode : FrameMode 39 | { 40 | /// 41 | /// Gets the format for this depth frame mode 42 | /// 43 | public DepthFormat Format 44 | { 45 | get 46 | { 47 | return this.depthFormat; 48 | } 49 | } 50 | 51 | /// 52 | /// Ninja constructor 53 | /// 54 | internal DepthFrameMode() 55 | { 56 | 57 | } 58 | 59 | /// 60 | /// Finds a mode, given a format and resolution. 61 | /// 62 | /// 63 | /// Depth format for the mode 64 | /// 65 | /// 66 | /// Resolution for the mode 67 | /// 68 | /// 69 | /// Mode with the format/resolution combo. Null if the combination is invalid. 70 | /// 71 | public static DepthFrameMode Find(DepthFormat format, Resolution resolution) 72 | { 73 | return (DepthFrameMode)FrameMode.FromInterop(KinectNative.freenect_find_depth_mode(resolution, format), FrameMode.FrameModeType.DepthFormat); 74 | } 75 | 76 | } 77 | } -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/VideoFrameMode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | using System; 28 | using System.Drawing; 29 | using System.Drawing.Imaging; 30 | using System.Runtime.InteropServices; 31 | using System.Collections.Generic; 32 | 33 | namespace freenect 34 | { 35 | /// 36 | /// Depth frame mode. 37 | /// 38 | public class VideoFrameMode : FrameMode 39 | { 40 | 41 | /// 42 | /// Gets the format for this video frame mode 43 | /// 44 | public VideoFormat Format 45 | { 46 | get 47 | { 48 | return this.videoFormat; 49 | } 50 | } 51 | 52 | /// 53 | /// Ninja constructor 54 | /// 55 | internal VideoFrameMode() 56 | { 57 | 58 | } 59 | 60 | /// 61 | /// Finds a mode, given a format and resolution. 62 | /// 63 | /// 64 | /// Video format for the mode 65 | /// 66 | /// 67 | /// Resolution for the mode 68 | /// 69 | /// 70 | /// Mode with the format/resolution combo. Null if the combination is invalid. 71 | /// 72 | public static VideoFrameMode Find(VideoFormat format, Resolution resolution) 73 | { 74 | return (VideoFrameMode)FrameMode.FromInterop(KinectNative.freenect_find_video_mode(resolution, format), FrameMode.FrameModeType.VideoFormat); 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/spec/freenect_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Freenect do 4 | context "singleton methods" do 5 | 6 | it "should create a new context" do 7 | ctx = Freenect.init() 8 | ctx.should be_kind_of(Freenect::Context) 9 | lambda { ctx.close }.should_not raise_error 10 | end 11 | 12 | it "should enumerate the video modes supported by the driver" do 13 | modes = Freenect.video_modes 14 | modes.should be_kind_of(Array) 15 | modes.length.should be > 0 16 | modes.each {|x| x.should be_kind_of(Freenect::FrameMode)} 17 | modes.each {|x| x.frame_mode_type.should == :video} 18 | end 19 | it "should be able to find basic video modes" do 20 | [ 21 | [:high,:rgb], [:medium,:rgb], 22 | [:high,:bayer], [:medium,:bayer], 23 | [:high,:ir_8bit], [:medium,:ir_8bit], 24 | [:high,:ir_10bit], [:medium,:ir_10bit], 25 | [:high,:ir_10bit_packed], [:medium,:ir_10bit_packed], 26 | ].each do |res,mode| 27 | x = Freenect.video_mode(res, mode) 28 | x.resolution.should == res 29 | x.format.should == mode 30 | end 31 | end 32 | it "should find the right sizes for video" do 33 | high = Freenect.video_mode(:high, :rgb) 34 | high.width.should == 1280 35 | high.height.should == 1024 36 | medium = Freenect.video_mode(:medium, :rgb) 37 | medium.width.should == 640 38 | medium.height.should == 480 39 | ir_8bit = Freenect.video_mode(:medium, :ir_8bit) 40 | ir_8bit.width.should == 640 41 | ir_8bit.height.should == 488 42 | end 43 | 44 | it "should enumerate the depth modes supported by the driver" do 45 | modes = Freenect.depth_modes 46 | modes.should be_kind_of(Array) 47 | modes.length.should be > 0 48 | modes.each {|x| x.should be_kind_of(Freenect::FrameMode)} 49 | modes.each {|x| x.frame_mode_type.should == :depth} 50 | end 51 | it "should be able to find basic depth modes" do 52 | [ 53 | [:medium,:depth_11bit], 54 | [:medium,:depth_10bit], 55 | [:medium,:depth_11bit_packed], 56 | [:medium,:depth_10bit_packed], 57 | ].each do |res,mode| 58 | x = Freenect.depth_mode(res, mode) 59 | x.resolution.should == res 60 | x.format.should == mode 61 | end 62 | end 63 | end 64 | it "should find the right sizes for depth" do 65 | depth = Freenect.depth_mode(:medium, :depth_11bit) 66 | depth.width.should == 640 67 | depth.height.should == 480 68 | end 69 | 70 | end 71 | 72 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/LogEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | using System; 28 | 29 | namespace freenect 30 | { 31 | /// 32 | /// Delegate for Kinect.Log event 33 | /// 34 | public delegate void LogEventHandler(object sender, LogEventArgs e); 35 | 36 | /// 37 | /// Log event data 38 | /// 39 | /// 40 | /// 41 | public class LogEventArgs 42 | { 43 | /// 44 | /// Gets the Kinect device this log item originated from 45 | /// 46 | public Kinect Device 47 | { 48 | get; 49 | set; 50 | } 51 | 52 | /// 53 | /// Gets the timestamp for this log item. This is done on the C# 54 | /// side and does not mean it was SENT EXACTLY at the specified 55 | /// time from the Kinect low level library. 56 | /// 57 | public DateTime Timestamp 58 | { 59 | get; 60 | private set; 61 | } 62 | 63 | /// 64 | /// Gets the logging level the library it set to 65 | /// 66 | public LoggingLevel LogLevel 67 | { 68 | get; 69 | private set; 70 | } 71 | 72 | /// 73 | /// Gets the log item text 74 | /// 75 | public string Message 76 | { 77 | get; 78 | private set; 79 | } 80 | 81 | public LogEventArgs(Kinect device, LoggingLevel logLevel, string message) 82 | { 83 | this.Device = device; 84 | this.LogLevel = logLevel; 85 | this.Message = message; 86 | } 87 | 88 | } 89 | } 90 | 91 | -------------------------------------------------------------------------------- /src/loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2011 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | #include "usb_libusb10.h" 31 | 32 | 33 | typedef struct { 34 | uint32_t magic; 35 | uint32_t tag; 36 | uint32_t bytes; 37 | uint32_t cmd; 38 | uint32_t addr; 39 | uint32_t unk; 40 | } bootloader_command; 41 | 42 | typedef struct { 43 | uint32_t magic; // Magic bytes. 2BL uses 0xF00BACCA, audios uses 0xCA77F00D 44 | uint16_t ver_minor; // The version string has four parts, each a 16-bit little-endian int. 45 | uint16_t ver_major; // Yes, minor comes before major. 46 | uint16_t ver_release; // 47 | uint16_t ver_patch; // 48 | uint32_t base_addr; // Base address of firmware image. 2BL starts at 0x10000, audios starts at 0x80000. 49 | uint32_t size; // Size of firmware image, in bytes 50 | uint32_t entry_addr; // Code entry point (absolute address) 51 | } firmware_header; 52 | 53 | typedef struct { 54 | uint32_t magic; 55 | uint32_t tag; 56 | uint32_t arg1; // initial command: 0. Firmware blocks: byte count. 57 | uint32_t cmd; 58 | uint32_t arg2; // initial command: byte count. Firmware blocks: target address. 59 | uint32_t zeros[8]; 60 | } cemdloader_command; 61 | 62 | typedef struct { 63 | uint32_t magic; 64 | uint32_t tag; 65 | uint32_t status; 66 | } bootloader_status_code; 67 | 68 | int upload_firmware(fnusb_dev* dev, char * fw_filename); 69 | int upload_firmware_from_memory(fnusb_dev* dev, unsigned char * fw_from_mem, unsigned int fw_size_in_bytes); 70 | 71 | int upload_cemd_data(fnusb_dev* dev); 72 | -------------------------------------------------------------------------------- /wrappers/csharp/src/lib/LED.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, you 15 | * may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 19 | * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * 23 | * Binary distributions must follow the binary distribution requirements of 24 | * either License. 25 | */ 26 | 27 | using System; 28 | 29 | namespace freenect 30 | { 31 | /// 32 | /// Provides control over the LED on the Kinect 33 | /// 34 | /// 35 | /// 36 | public class LED 37 | { 38 | /// 39 | /// Parent Kinect instance 40 | /// 41 | private Kinect parentDevice; 42 | 43 | /// 44 | /// Current color set on the LED 45 | /// 46 | private LEDColor color; 47 | 48 | /// 49 | /// Gets or sets the LED color on the Kinect device 50 | /// 51 | /// Gets or sets 'color' field 52 | public LEDColor Color 53 | { 54 | get 55 | { 56 | return this.color; 57 | } 58 | set 59 | { 60 | this.SetLEDColor(value); 61 | } 62 | } 63 | 64 | /// 65 | /// Constructor 66 | /// 67 | /// 68 | /// Parent device that this LED is part of 69 | /// 70 | internal LED(Kinect parent) 71 | { 72 | this.parentDevice = parent; 73 | } 74 | 75 | /// 76 | /// Sets the color for the LED on the Kinect. 77 | /// 78 | /// 79 | /// Color value 80 | /// 81 | private void SetLEDColor(LEDColor color) 82 | { 83 | int result = KinectNative.freenect_set_led(this.parentDevice.devicePointer, color); 84 | if(result != 0) 85 | { 86 | throw new Exception("Could not set color to " + color + ". Error Code:" + result); 87 | } 88 | this.color = color; 89 | } 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################################### 2 | # Packages needed for examples 3 | ###################################################################################### 4 | 5 | # These examples have no external dependencies and should always build. 6 | add_executable(freenect-camtest camtest.c) 7 | add_executable(freenect-wavrecord wavrecord.c) 8 | target_link_libraries(freenect-camtest freenect) 9 | target_link_libraries(freenect-wavrecord freenect) 10 | install(TARGETS freenect-camtest freenect-wavrecord 11 | DESTINATION bin) 12 | 13 | # Most viewers need pthreads and GLUT. 14 | set(THREADS_USE_PTHREADS_WIN32 true) 15 | find_package(Threads) 16 | find_package(OpenGL) 17 | find_package(GLUT) 18 | 19 | if (Threads_FOUND AND OPENGL_FOUND AND GLUT_FOUND) 20 | include_directories(${THREADS_PTHREADS_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}) 21 | 22 | add_executable(freenect-glview glview.c) 23 | add_executable(freenect-regview regview.c) 24 | add_executable(freenect-hiview hiview.c) 25 | add_executable(freenect-chunkview chunkview.c) 26 | add_executable(freenect-micview micview.c) 27 | 28 | target_link_libraries(freenect-glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 29 | target_link_libraries(freenect-regview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 30 | target_link_libraries(freenect-hiview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 31 | target_link_libraries(freenect-chunkview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 32 | target_link_libraries(freenect-micview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB}) 33 | 34 | install(TARGETS freenect-glview freenect-regview freenect-hiview freenect-chunkview freenect-micview 35 | DESTINATION bin) 36 | endif () 37 | 38 | # A few examples use c_sync. 39 | if (BUILD_C_SYNC) 40 | include_directories(../wrappers/c_sync/) 41 | 42 | add_executable(freenect-regtest regtest.c) 43 | add_executable(freenect-tiltdemo tiltdemo.c) 44 | 45 | target_link_libraries(freenect-regtest freenect_sync ${MATH_LIB}) 46 | target_link_libraries(freenect-tiltdemo freenect_sync ${MATH_LIB}) 47 | 48 | install(TARGETS freenect-regtest freenect-tiltdemo 49 | DESTINATION bin) 50 | 51 | if (OPENGL_FOUND AND GLUT_FOUND) 52 | include_directories(${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}) 53 | add_executable(freenect-glpclview glpclview.c) 54 | target_link_libraries(freenect-glpclview freenect_sync ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${MATH_LIB}) 55 | install(TARGETS freenect-glpclview 56 | DESTINATION bin) 57 | endif () 58 | endif () 59 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/OniVersion.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #include "OniPlatform.h" 22 | 23 | #define ONI_VERSION_MAJOR 2 24 | #define ONI_VERSION_MINOR 2 25 | #define ONI_VERSION_MAINTENANCE 0 26 | #define ONI_VERSION_BUILD 33 27 | 28 | /** OpenNI version (in brief string format): "Major.Minor.Maintenance (Build)" */ 29 | #define ONI_BRIEF_VERSION_STRING \ 30 | ONI_STRINGIFY(ONI_VERSION_MAJOR) "." \ 31 | ONI_STRINGIFY(ONI_VERSION_MINOR) "." \ 32 | ONI_STRINGIFY(ONI_VERSION_MAINTENANCE) \ 33 | " (Build " ONI_STRINGIFY(ONI_VERSION_BUILD) ")" 34 | 35 | /** OpenNI version (in numeric format): (OpenNI major version * 100000000 + OpenNI minor version * 1000000 + OpenNI maintenance version * 10000 + OpenNI build version). */ 36 | #define ONI_VERSION (ONI_VERSION_MAJOR*100000000 + ONI_VERSION_MINOR*1000000 + ONI_VERSION_MAINTENANCE*10000 + ONI_VERSION_BUILD) 37 | #define ONI_CREATE_API_VERSION(major, minor) ((major)*1000 + (minor)) 38 | #define ONI_API_VERSION ONI_CREATE_API_VERSION(ONI_VERSION_MAJOR, ONI_VERSION_MINOR) 39 | 40 | /** OpenNI version (in string format): "Major.Minor.Maintenance.Build-Platform (MMM DD YYYY HH:MM:SS)". */ 41 | #define ONI_VERSION_STRING \ 42 | ONI_BRIEF_VERSION_STRING "-" \ 43 | ONI_PLATFORM_STRING " (" ONI_TIMESTAMP ")" 44 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/Driver/OniDriverTypes.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_DRIVER_TYPES_H_ 22 | #define _ONI_DRIVER_TYPES_H_ 23 | 24 | #include 25 | #include 26 | 27 | #define ONI_STREAM_PROPERTY_PRIVATE_BASE XN_MAX_UINT16 28 | 29 | typedef struct 30 | { 31 | int dataSize; 32 | void* data; 33 | } OniGeneralBuffer; 34 | 35 | /////// DriverServices 36 | struct OniDriverServices 37 | { 38 | void* driverServices; 39 | void (ONI_CALLBACK_TYPE* errorLoggerAppend)(void* driverServices, const char* format, va_list args); 40 | void (ONI_CALLBACK_TYPE* errorLoggerClear)(void* driverServices); 41 | void (ONI_CALLBACK_TYPE* log)(void* driverServices, int severity, const char* file, int line, const char* mask, const char* message); 42 | }; 43 | 44 | struct OniStreamServices 45 | { 46 | void* streamServices; 47 | int (ONI_CALLBACK_TYPE* getDefaultRequiredFrameSize)(void* streamServices); 48 | OniFrame* (ONI_CALLBACK_TYPE* acquireFrame)(void* streamServices); // returns a frame with size corresponding to getRequiredFrameSize() 49 | void (ONI_CALLBACK_TYPE* addFrameRef)(void* streamServices, OniFrame* pframe); 50 | void (ONI_CALLBACK_TYPE* releaseFrame)(void* streamServices, OniFrame* pframe); 51 | }; 52 | 53 | 54 | #endif // _ONI_DRIVER_TYPES_H_ 55 | -------------------------------------------------------------------------------- /wrappers/java/src/main/java/org/openkinect/freenect/FrameMode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is part of the OpenKinect Project. http://www.openkinect.org 3 | * 4 | * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file 5 | * for details. 6 | * 7 | * This code is licensed to you under the terms of the Apache License, version 8 | * 2.0, or, at your option, the terms of the GNU General Public License, 9 | * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses, 10 | * or the following URLs: 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * http://www.gnu.org/licenses/gpl-2.0.txt 13 | * 14 | * If you redistribute this file in source form, modified or unmodified, 15 | * you may: 16 | * 1) Leave this header intact and distribute it under the same terms, 17 | * accompanying it with the APACHE20 and GPL20 files, or 18 | * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or 19 | * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file 20 | * In all cases you must keep the copyright notice intact and include a copy 21 | * of the CONTRIB file. 22 | * Binary distributions must follow the binary distribution requirements of 23 | * either License. 24 | */ 25 | package org.openkinect.freenect; 26 | 27 | import com.sun.jna.Structure; 28 | import java.util.List; 29 | import java.util.Arrays; 30 | 31 | public class FrameMode extends Structure { 32 | /* All fields are public because Structure requires it. 33 | However, fields should NOT be altered by external code. */ 34 | public int reserved; 35 | public int resolution; 36 | public int format; 37 | public int bytes; 38 | public short width, height; 39 | public byte dataBitsPerPixel, paddingBitsPerPixel; 40 | public byte framerate, valid; 41 | 42 | public FrameMode() { 43 | valid = 0; 44 | } 45 | 46 | protected List getFieldOrder() { 47 | return Arrays.asList(new String[] {"reserved", "resolution", "format", 48 | "bytes", "width", "height", "dataBitsPerPixel", 49 | "paddingBitsPerPixel", "framerate", "valid"}); 50 | } 51 | 52 | public Resolution getResolution() { 53 | return Resolution.fromInt(resolution); 54 | } 55 | 56 | public DepthFormat getDepthFormat() { 57 | return DepthFormat.fromInt(format); 58 | } 59 | 60 | public VideoFormat getVideoFormat() { 61 | return VideoFormat.fromInt(format); 62 | } 63 | 64 | public int getFrameSize() { 65 | return bytes; 66 | } 67 | 68 | public short getWidth() { 69 | return width; 70 | } 71 | 72 | public short getHeight() { 73 | return height; 74 | } 75 | 76 | public int getFrameRate() { 77 | return framerate; 78 | } 79 | 80 | public boolean isValid() { 81 | return (valid != 0); 82 | } 83 | 84 | public static class ByValue extends FrameMode implements Structure.ByValue { } 85 | } 86 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/src/ColorStream.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ColorStream.hpp" 3 | 4 | using namespace FreenectDriver; 5 | 6 | 7 | ColorStream::ColorStream(Freenect::FreenectDevice* pDevice) : VideoStream(pDevice) 8 | { 9 | video_mode = makeOniVideoMode(ONI_PIXEL_FORMAT_RGB888, 640, 480, 30); 10 | setVideoMode(video_mode); 11 | pDevice->startVideo(); 12 | } 13 | 14 | // Add video modes here as you implement them 15 | ColorStream::FreenectVideoModeMap ColorStream::getSupportedVideoModes() 16 | { 17 | FreenectVideoModeMap modes; 18 | // pixelFormat, resolutionX, resolutionY, fps freenect_video_format, freenect_resolution 19 | modes[makeOniVideoMode(ONI_PIXEL_FORMAT_RGB888, 640, 480, 30)] = std::pair(FREENECT_VIDEO_RGB, FREENECT_RESOLUTION_MEDIUM); 20 | 21 | 22 | return modes; 23 | 24 | /* working format possiblities 25 | FREENECT_VIDEO_RGB 26 | FREENECT_VIDEO_YUV_RGB 27 | FREENECT_VIDEO_YUV_RAW 28 | */ 29 | } 30 | 31 | OniStatus ColorStream::setVideoMode(OniVideoMode requested_mode) 32 | { 33 | FreenectVideoModeMap supported_video_modes = getSupportedVideoModes(); 34 | FreenectVideoModeMap::const_iterator matched_mode_iter = supported_video_modes.find(requested_mode); 35 | if (matched_mode_iter == supported_video_modes.end()) 36 | return ONI_STATUS_NOT_SUPPORTED; 37 | 38 | freenect_video_format format = matched_mode_iter->second.first; 39 | freenect_resolution resolution = matched_mode_iter->second.second; 40 | 41 | try { device->setVideoFormat(format, resolution); } 42 | catch (std::runtime_error e) 43 | { 44 | LogError("Format " + to_string(format) + " and resolution " + to_string(resolution) + " combination not supported by libfreenect"); 45 | return ONI_STATUS_NOT_SUPPORTED; 46 | } 47 | video_mode = requested_mode; 48 | return ONI_STATUS_OK; 49 | } 50 | 51 | void ColorStream::populateFrame(void* data, OniFrame* frame) const 52 | { 53 | frame->sensorType = SENSOR_TYPE; 54 | frame->stride = video_mode.resolutionX * 3; 55 | frame->cropOriginX = 0; 56 | frame->cropOriginY = 0; 57 | frame->croppingEnabled = false; 58 | 59 | // copy stream buffer from freenect 60 | switch (video_mode.pixelFormat) 61 | { 62 | default: 63 | LogError("Pixel format " + to_string(video_mode.pixelFormat) + " not supported by populateFrame()"); 64 | return; 65 | 66 | case ONI_PIXEL_FORMAT_RGB888: 67 | uint8_t* source = static_cast(data); 68 | uint8_t* target = static_cast(frame->data); 69 | std::copy(source, source + frame->dataSize, target); 70 | return; 71 | } 72 | } 73 | 74 | /* color video modes reference 75 | 76 | FREENECT_VIDEO_RGB = 0, //< Decompressed RGB mode (demosaicing done by libfreenect) 77 | FREENECT_VIDEO_BAYER = 1, //< Bayer compressed mode (raw information from camera) 78 | FREENECT_VIDEO_YUV_RGB = 5, //< YUV RGB mode 79 | FREENECT_VIDEO_YUV_RAW = 6, //< YUV Raw mode 80 | 81 | ONI_PIXEL_FORMAT_RGB888 = 200, 82 | ONI_PIXEL_FORMAT_YUV422 = 201, 83 | ONI_PIXEL_FORMAT_JPEG = 204, 84 | */ 85 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/examples/tilt_led.rb: -------------------------------------------------------------------------------- 1 | class TILT_LED 2 | 3 | def initialize 4 | $: << File.expand_path(File.join(File.dirname(__FILE__), '../lib')) 5 | require 'freenect' 6 | check_args 7 | initialize_device 8 | tilt_led_set 9 | cleanup 10 | end 11 | 12 | # 13 | # Define usage 14 | # 15 | def script_usage 16 | puts "Usage: ruby tilt_led.rb -l (0-6) -t (-30-30)" 17 | puts "LED Options:" 18 | puts " 0 - Off" 19 | puts " 1 - Green" 20 | puts " 2 - Red" 21 | puts " 3 - Yellow" 22 | puts " 4 - Blink Yellow" 23 | puts " 5 - Blink Green" 24 | puts " 6 - Blink Red/Yellow" 25 | puts "Tilt Options:" 26 | puts " Value must be between -30 and 30 degrees." 27 | exit 1 28 | end 29 | 30 | # 31 | # Check arguments. I'm sure there's a better way to do this. What can I saw, I'm a noob. 32 | # 33 | def check_args 34 | if( ARGV.include?("-l") || ARGV.include?("-t") ) 35 | if (ARGV.include?("-l")) 36 | @led_option = ARGV[(ARGV.index("-l") + 1 )] 37 | ARGV.delete("-l") 38 | ARGV.delete(@led_option) 39 | if @led_option.to_i < 0 || @led_option.to_i > 6 40 | script_usage 41 | end 42 | end 43 | if (ARGV.include?("-t")) 44 | @tilt_option = ARGV[(ARGV.index("-t") + 1 )] 45 | ARGV.delete("-t") 46 | ARGV.delete(@tilt_option) 47 | if @tilt_option.to_i < -30 || @tilt_option.to_i > 30 48 | script_usage 49 | end 50 | end 51 | else 52 | script_usage 53 | end 54 | end 55 | 56 | def initialize_device 57 | @ctx = FFI::MemoryPointer.new(:pointer) 58 | @dev = FFI::MemoryPointer.new(:pointer) 59 | # 60 | # initialize context / @device 61 | # 62 | if (FFI::Freenect.freenect_init(@ctx,nil) != 0) 63 | puts "Error: can't initialize context" 64 | exit 1 65 | end 66 | @ctx = @ctx.read_pointer 67 | 68 | if (FFI::Freenect.freenect_open_device(@ctx, @dev, 0) != 0) 69 | puts "Error: can't initialize device" 70 | exit 1 71 | end 72 | @dev = @dev.read_pointer 73 | end 74 | 75 | def tilt_led_set 76 | # 77 | # Set tilt and/or led options on the @device 78 | # 79 | puts "Number of devices: #{FFI::Freenect.freenect_num_devices(@ctx)}" 80 | if (not @tilt_option.nil?) 81 | puts "Tilt set to: #{@tilt_option}" 82 | FFI::Freenect.freenect_set_tilt_degs(@dev, @tilt_option.to_f) 83 | end 84 | if (not @led_option.nil?) 85 | puts "LED set to: #{@led_option}" 86 | FFI::Freenect.freenect_set_led(@dev, @led_option.to_i) 87 | end 88 | end 89 | 90 | def cleanup 91 | # 92 | # Close the context and @device (for cleanup purposes) 93 | # 94 | FFI::Freenect.freenect_close_device(@dev) 95 | if FFI::Freenect.freenect_shutdown(@ctx) != 0 96 | puts "Error shutting down context" 97 | exit 1 98 | else 99 | puts "Successfully shut down context" 100 | exit 0 101 | end 102 | end 103 | end 104 | 105 | run = TILT_LED.new -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/OniEnums.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_ENUMS_H_ 22 | #define _ONI_ENUMS_H_ 23 | 24 | namespace openni 25 | { 26 | 27 | /** Possible failure values */ 28 | typedef enum 29 | { 30 | STATUS_OK = 0, 31 | STATUS_ERROR = 1, 32 | STATUS_NOT_IMPLEMENTED = 2, 33 | STATUS_NOT_SUPPORTED = 3, 34 | STATUS_BAD_PARAMETER = 4, 35 | STATUS_OUT_OF_FLOW = 5, 36 | STATUS_NO_DEVICE = 6, 37 | STATUS_TIME_OUT = 102, 38 | } Status; 39 | 40 | /** The source of the stream */ 41 | typedef enum 42 | { 43 | SENSOR_IR = 1, 44 | SENSOR_COLOR = 2, 45 | SENSOR_DEPTH = 3, 46 | 47 | } SensorType; 48 | 49 | /** All available formats of the output of a stream */ 50 | typedef enum 51 | { 52 | // Depth 53 | PIXEL_FORMAT_DEPTH_1_MM = 100, 54 | PIXEL_FORMAT_DEPTH_100_UM = 101, 55 | PIXEL_FORMAT_SHIFT_9_2 = 102, 56 | PIXEL_FORMAT_SHIFT_9_3 = 103, 57 | 58 | // Color 59 | PIXEL_FORMAT_RGB888 = 200, 60 | PIXEL_FORMAT_YUV422 = 201, 61 | PIXEL_FORMAT_GRAY8 = 202, 62 | PIXEL_FORMAT_GRAY16 = 203, 63 | PIXEL_FORMAT_JPEG = 204, 64 | PIXEL_FORMAT_YUYV = 205, 65 | } PixelFormat; 66 | 67 | typedef enum 68 | { 69 | DEVICE_STATE_OK = 0, 70 | DEVICE_STATE_ERROR = 1, 71 | DEVICE_STATE_NOT_READY = 2, 72 | DEVICE_STATE_EOF = 3 73 | } DeviceState; 74 | 75 | typedef enum 76 | { 77 | IMAGE_REGISTRATION_OFF = 0, 78 | IMAGE_REGISTRATION_DEPTH_TO_COLOR = 1, 79 | } ImageRegistrationMode; 80 | 81 | static const int TIMEOUT_NONE = 0; 82 | static const int TIMEOUT_FOREVER = -1; 83 | 84 | } // namespace openni 85 | 86 | #endif // _ONI_ENUMS_H_ 87 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/OniCEnums.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_C_ENUMS_H_ 22 | #define _ONI_C_ENUMS_H_ 23 | 24 | /** Possible failure values */ 25 | typedef enum 26 | { 27 | ONI_STATUS_OK = 0, 28 | ONI_STATUS_ERROR = 1, 29 | ONI_STATUS_NOT_IMPLEMENTED = 2, 30 | ONI_STATUS_NOT_SUPPORTED = 3, 31 | ONI_STATUS_BAD_PARAMETER = 4, 32 | ONI_STATUS_OUT_OF_FLOW = 5, 33 | ONI_STATUS_NO_DEVICE = 6, 34 | ONI_STATUS_TIME_OUT = 102, 35 | } OniStatus; 36 | 37 | /** The source of the stream */ 38 | typedef enum 39 | { 40 | ONI_SENSOR_IR = 1, 41 | ONI_SENSOR_COLOR = 2, 42 | ONI_SENSOR_DEPTH = 3, 43 | 44 | } OniSensorType; 45 | 46 | /** All available formats of the output of a stream */ 47 | typedef enum 48 | { 49 | // Depth 50 | ONI_PIXEL_FORMAT_DEPTH_1_MM = 100, 51 | ONI_PIXEL_FORMAT_DEPTH_100_UM = 101, 52 | ONI_PIXEL_FORMAT_SHIFT_9_2 = 102, 53 | ONI_PIXEL_FORMAT_SHIFT_9_3 = 103, 54 | 55 | // Color 56 | ONI_PIXEL_FORMAT_RGB888 = 200, 57 | ONI_PIXEL_FORMAT_YUV422 = 201, 58 | ONI_PIXEL_FORMAT_GRAY8 = 202, 59 | ONI_PIXEL_FORMAT_GRAY16 = 203, 60 | ONI_PIXEL_FORMAT_JPEG = 204, 61 | ONI_PIXEL_FORMAT_YUYV = 205, 62 | } OniPixelFormat; 63 | 64 | typedef enum 65 | { 66 | ONI_DEVICE_STATE_OK = 0, 67 | ONI_DEVICE_STATE_ERROR = 1, 68 | ONI_DEVICE_STATE_NOT_READY = 2, 69 | ONI_DEVICE_STATE_EOF = 3 70 | } OniDeviceState; 71 | 72 | typedef enum 73 | { 74 | ONI_IMAGE_REGISTRATION_OFF = 0, 75 | ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR = 1, 76 | } OniImageRegistrationMode; 77 | 78 | enum 79 | { 80 | ONI_TIMEOUT_NONE = 0, 81 | ONI_TIMEOUT_FOREVER = -1, 82 | }; 83 | 84 | #endif // _ONI_C_ENUMS_H_ 85 | -------------------------------------------------------------------------------- /wrappers/ruby/ffi-libfreenect/lib/freenect/sync.rb: -------------------------------------------------------------------------------- 1 | 2 | require 'freenect' 3 | 4 | module Freenect 5 | module Sync 6 | class FormatError < StandardError 7 | end 8 | 9 | # Synchronous video function (starts the runloop if it isn't running) 10 | # 11 | # @param idx 12 | # Device index. Default: 0 13 | # 14 | # @param fmt 15 | # Video Format. See FFI::Freenect::VIDEO_FORMATS. Default is :rgb 16 | # 17 | # @return [Numeric, String] 18 | # Returns an array containing a numeric timestamp and the video buffer 19 | # snapshot with a size based on the requested video format. 20 | # 21 | # @raise FormatError 22 | # An exception is raised if an invalid format is specified. 23 | # 24 | # @raise RuntimeError 25 | # An exception is raised if an unknown error occurs in the 26 | # freenect_sync_get_video function 27 | # 28 | def self.get_video(idx=nil, fmt=nil) 29 | idx ||= 0 30 | fmt ||= :rgb 31 | 32 | if (buf_size = Freenect.lookup_video_size(fmt)).nil? 33 | raise(FormatError, "Invalid video format: #{fmt.inspect}") 34 | end 35 | 36 | video_p = FFI::MemoryPointer.new(buf_size) 37 | timestamp_p = FFI::MemoryPointer.new(:uint32) 38 | 39 | ret = ::FFI::Freenect.freenect_sync_get_video(video_p, timestamp_p, idx, Freenect.lookup_video_format(fmt)) 40 | 41 | if ret != 0 42 | raise("Unknown error in freenect_sync_get_video()") # TODO is errno set or something here? 43 | else 44 | return [timestamp_p.read_int, video_p.read_string_length(buf_size)] 45 | end 46 | end 47 | 48 | # Synchronous depth function (starts the runloop if it isn't running) 49 | # 50 | # @param idx 51 | # Device index. Default: 0 52 | # 53 | # @param fmt 54 | # Video Format. See FFI::Freenect::DEPTH_FORMATS. Default is :rgb 55 | # 56 | # @return [Numeric, String] 57 | # Returns an array containing a numeric timestamp and the depth buffer 58 | # snapshot with a size based on the requested video format. 59 | # 60 | # @raise FormatError 61 | # An exception is raised if an invalid format is specified. 62 | # 63 | # @raise RuntimeError 64 | # An exception is raised if an unknown error occurs in the 65 | # freenect_sync_get_video function 66 | # 67 | def self.get_depth(idx=0, fmt=:depth_11bit) 68 | idx ||= 0 69 | fmt ||= :depth_11bit 70 | 71 | if (buf_size = Freenect.lookup_depth_size(fmt)).nil? 72 | raise(FormatError, "Invalid depth format: #{fmt.inspect}") 73 | end 74 | 75 | depth_p = FFI::MemoryPointer.new(buf_size) 76 | timestamp_p = FFI::MemoryPointer.new(:uint32) 77 | 78 | ret = ::FFI::Freenect.freenect_sync_get_depth(depth_p, timestamp_p, idx, Freenect.lookup_depth_format(fmt)) 79 | if ret != 0 80 | raise("Unknown error in freenect_sync_get_depth()") # TODO is errno set or something here? 81 | else 82 | return [timestamp_p.read_int, video_p.read_string_length(buf_size)] 83 | end 84 | end 85 | 86 | # Stops the sync runloop 87 | def self.stop 88 | FFI::Freenect.freenect_sync_stop() 89 | end 90 | 91 | end 92 | end 93 | 94 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/OniProperties.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_PROPERTIES_H_ 22 | #define _ONI_PROPERTIES_H_ 23 | 24 | namespace openni 25 | { 26 | 27 | // Device properties 28 | enum 29 | { 30 | DEVICE_PROPERTY_FIRMWARE_VERSION = 0, // string 31 | DEVICE_PROPERTY_DRIVER_VERSION = 1, // OniVersion 32 | DEVICE_PROPERTY_HARDWARE_VERSION = 2, // int 33 | DEVICE_PROPERTY_SERIAL_NUMBER = 3, // string 34 | DEVICE_PROPERTY_ERROR_STATE = 4, // ?? 35 | DEVICE_PROPERTY_IMAGE_REGISTRATION = 5, // OniImageRegistrationMode 36 | 37 | // Files 38 | DEVICE_PROPERTY_PLAYBACK_SPEED = 100, // float 39 | DEVICE_PROPERTY_PLAYBACK_REPEAT_ENABLED = 101, // OniBool 40 | }; 41 | 42 | // Stream properties 43 | enum 44 | { 45 | STREAM_PROPERTY_CROPPING = 0, // OniCropping* 46 | STREAM_PROPERTY_HORIZONTAL_FOV = 1, // float: radians 47 | STREAM_PROPERTY_VERTICAL_FOV = 2, // float: radians 48 | STREAM_PROPERTY_VIDEO_MODE = 3, // OniVideoMode* 49 | 50 | STREAM_PROPERTY_MAX_VALUE = 4, // int 51 | STREAM_PROPERTY_MIN_VALUE = 5, // int 52 | 53 | STREAM_PROPERTY_STRIDE = 6, // int 54 | STREAM_PROPERTY_MIRRORING = 7, // OniBool 55 | 56 | STREAM_PROPERTY_NUMBER_OF_FRAMES = 8, // int 57 | 58 | // Camera 59 | STREAM_PROPERTY_AUTO_WHITE_BALANCE = 100, // OniBool 60 | STREAM_PROPERTY_AUTO_EXPOSURE = 101, // OniBool 61 | STREAM_PROPERTY_EXPOSURE = 102, // int 62 | STREAM_PROPERTY_GAIN = 103, // int 63 | 64 | }; 65 | 66 | // Device commands (for Invoke) 67 | enum 68 | { 69 | DEVICE_COMMAND_SEEK = 1, // OniSeek 70 | }; 71 | 72 | } // namespace openni 73 | #endif // _ONI_PROPERTIES_H_ 74 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/README.md: -------------------------------------------------------------------------------- 1 | OpenNI2-FreenectDriver 2 | ====================== 3 | 4 | OpenNI2-FreenectDriver is a bridge to libfreenect implemented as an OpenNI2 driver. 5 | It allows OpenNI2 to use Kinect hardware on Linux and OSX. 6 | OpenNI2-FreenectDriver is distributed under the [Apache 2](https://github.com/OpenKinect/libfreenect/blob/master/APACHE20) license. 7 | 8 | Install 9 | ------- 10 | 1. Download and unpack [OpenNI](http://structure.io/openni) 2.2.0.33 or higher. 11 | 2. Go to the top libfreenect directory and build it with the OpenNI2 driver. 12 | 13 | mkdir build 14 | cd build 15 | cmake .. -DBUILD_OPENNI2_DRIVER=ON 16 | make 17 | 18 | 3. Copy the driver to your OpenNI2 driver repository. You must first change `Repository` to match your project layout. 19 | 20 | Repository="/example/path/to/Samples/Bin/OpenNI2/Drivers/" 21 | cp -L lib/OpenNI2-FreenectDriver/libFreenectDriver.{so,dylib} ${Repository} 22 | 23 | # you could instead make a symlink to avoid copying after every build 24 | # ln -s lib/OpenNI2-FreenectDriver/libFreenectDriver.{so,dylib} ${Repository} 25 | 26 | OpenNI2-FreenectDriver is built with a static libfreenect, so you do not need to include libfreenect when deploying. 27 | However, you will need to make sure target systems have libusb and all other dependencies listed in `ldd libFreenectDriver.so`. 28 | 29 | __________________________________________________ 30 | 31 | Structure 32 | --------- 33 | This driver is modeled on TestDevice.cpp and Drivers/Kinect/. 34 | In the FreenectDriver namespace, it ties together the C++ interfaces of OpenNI2 and libfreenect using multiple inheritance. 35 | 36 | Driver inherits publically from oni::driver::DriverBase and privately from Freenect::Freenect. 37 | libfreenect.hpp allows protected access to the Freenect context, so that FreenectDriver can call the Freenect's C API. 38 | As a DriverBase, FreenectDriver manages devices and sets up device state callbacks. 39 | 40 | Device inherits publically from oni::driver::DeviceBase and Freenect::FreenectDevice. 41 | Because of this, it can be built by Freenect::Freenect::createDevice() and it can define Device's depth and video callbacks. 42 | Those callbacks trigger acquireFrame() in FreenectStream. 43 | 44 | VideoStream is a virtual base class inheriting from oni::driver::StreamBase. 45 | It does generic frame setup in buildFrame() and then calls pure virtual populateFrame() to let derived classes finish the frame. 46 | It also provides the base skeleton for setting and getting properties, which cascades down the inheritance tree. 47 | 48 | DepthStream and ColorStream are nearly identical in definition and implementation, both inheriting from VideoStream. 49 | They differ mostly in the formats they use to process data and the video modes they support. 50 | These two classes offer a system to store and report supported video modes. 51 | To implement a new mode, simply add it to getSupportedVideoModes() and modify populateFrame() as necessary. 52 | 53 | __________________________________________________ 54 | 55 | Todo 56 | ---- 57 | * support more FREENECT_RESOLUTION_\*, FREENECT_VIDEO_\*, and FREENECT_DEPTH_\* 58 | * provide more OniVideoMode and OniStreamProperty 59 | * implement remaining derived functions 60 | -------------------------------------------------------------------------------- /OpenNI2-FreenectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/OniCProperties.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * * 3 | * OpenNI 2.x Alpha * 4 | * Copyright (C) 2012 PrimeSense Ltd. * 5 | * * 6 | * This file is part of OpenNI. * 7 | * * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); * 9 | * you may not use this file except in compliance with the License. * 10 | * You may obtain a copy of the License at * 11 | * * 12 | * http://www.apache.org/licenses/LICENSE-2.0 * 13 | * * 14 | * Unless required by applicable law or agreed to in writing, software * 15 | * distributed under the License is distributed on an "AS IS" BASIS, * 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 17 | * See the License for the specific language governing permissions and * 18 | * limitations under the License. * 19 | * * 20 | *****************************************************************************/ 21 | #ifndef _ONI_C_PROPERTIES_H_ 22 | #define _ONI_C_PROPERTIES_H_ 23 | 24 | // Device properties 25 | enum 26 | { 27 | ONI_DEVICE_PROPERTY_FIRMWARE_VERSION = 0, // By implementation 28 | ONI_DEVICE_PROPERTY_DRIVER_VERSION = 1, // OniVersion 29 | ONI_DEVICE_PROPERTY_HARDWARE_VERSION = 2, // int 30 | ONI_DEVICE_PROPERTY_SERIAL_NUMBER = 3, // string 31 | ONI_DEVICE_PROPERTY_ERROR_STATE = 4, // ?? 32 | ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION = 5, // OniImageRegistrationMode 33 | 34 | // Files 35 | ONI_DEVICE_PROPERTY_PLAYBACK_SPEED = 100, // float 36 | ONI_DEVICE_PROPERTY_PLAYBACK_REPEAT_ENABLED = 101, // OniBool 37 | }; 38 | 39 | // Stream properties 40 | enum 41 | { 42 | ONI_STREAM_PROPERTY_CROPPING = 0, // OniCropping* 43 | ONI_STREAM_PROPERTY_HORIZONTAL_FOV = 1, // float: radians 44 | ONI_STREAM_PROPERTY_VERTICAL_FOV = 2, // float: radians 45 | ONI_STREAM_PROPERTY_VIDEO_MODE = 3, // OniVideoMode* 46 | 47 | ONI_STREAM_PROPERTY_MAX_VALUE = 4, // int 48 | ONI_STREAM_PROPERTY_MIN_VALUE = 5, // int 49 | 50 | ONI_STREAM_PROPERTY_STRIDE = 6, // int 51 | ONI_STREAM_PROPERTY_MIRRORING = 7, // OniBool 52 | 53 | ONI_STREAM_PROPERTY_NUMBER_OF_FRAMES = 8, // int 54 | 55 | // Camera 56 | ONI_STREAM_PROPERTY_AUTO_WHITE_BALANCE = 100, // OniBool 57 | ONI_STREAM_PROPERTY_AUTO_EXPOSURE = 101, // OniBool 58 | ONI_STREAM_PROPERTY_EXPOSURE = 102, // int 59 | ONI_STREAM_PROPERTY_GAIN = 103, // int 60 | }; 61 | 62 | // Device commands (for Invoke) 63 | enum 64 | { 65 | ONI_DEVICE_COMMAND_SEEK = 1, // OniSeek 66 | }; 67 | 68 | #endif // _ONI_C_PROPERTIES_H_ 69 | --------------------------------------------------------------------------------