-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from piedar/OpenNI2-FreenectDriver
OpenNI2-FreenectDriver
- Loading branch information
Showing
31 changed files
with
7,827 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
###################################################################################### | ||
# OpenNI2-FreenectDriver | ||
###################################################################################### | ||
|
||
file(GLOB SOURCES src/*.cpp) | ||
add_library(FreenectDriver SHARED ${SOURCES}) | ||
|
||
set(CMAKE_CXX_FLAGS "-Wno-gnu-static-float-init -Wno-unused-function") | ||
|
||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib/OpenNI2-FreenectDriver) | ||
set_target_properties( FreenectDriver PROPERTIES | ||
VERSION ${PROJECT_VER} | ||
SOVERSION ${PROJECT_APIVER} | ||
OUTPUT_NAME FreenectDriver) | ||
|
||
include_directories(extern/OpenNI-Linux-x64-2.2.0.33/Include) | ||
include_directories(${PROJECT_SOURCE_DIR}/wrappers/cpp) | ||
|
||
target_link_libraries(FreenectDriver freenectstatic ${MATH_LIB}) | ||
|
||
install (TARGETS FreenectDriver | ||
DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}/OpenNI2-FreenectDriver") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
OpenNI2-FreenectDriver | ||
====================== | ||
|
||
OpenNI2-FreenectDriver is a bridge to libfreenect implemented as an OpenNI2 driver. | ||
It allows OpenNI2 to use Kinect hardware on Linux and OSX. | ||
It was originally a [separate project](https://github.com/piedar/OpenNI2-FreenectDriver) but is now distributed with libfreenect. | ||
OpenNI2-FreenectDriver is distributed under the Apache 2 license. | ||
|
||
Install | ||
------- | ||
1. Download and unpack [OpenNI](http://www.openni.org/openni-sdk/) 2.2.0.33 or higher. | ||
2. Build libfreenect with the OpenNI2 driver. | ||
|
||
mkdir build && cd build | ||
cmake .. -DBUILD_OPENNI2_DRIVER=ON | ||
make | ||
|
||
3. Copy the driver to your OpenNI2 driver repository. | ||
|
||
Repository="/example/path/to/Samples/Bin/OpenNI2/Drivers/" | ||
cp -L lib/OpenNI2-FreenectDriver/libFreenectDriver.{so,dylib} ${Repository} | ||
|
||
OpenNI2-FreenectDriver is built with a static libfreenect, so you do not need to include libfreenect when deploying. | ||
However, you will need to make sure target systems have libusb and all other libfreenect dependencies. | ||
|
||
__________________________________________________ | ||
|
||
Structure | ||
--------- | ||
This driver is modeled on TestDevice.cpp and Drivers/Kinect/. In the FreenectDriver namespace, it ties together the C++ interfaces of OpenNI2 and libfreenect using multiple inheritance. | ||
|
||
Driver inherits publically from oni::driver::DriverBase and privately from Freenect::Freenect. A custom libfreenect.hpp allows protected access to the Freenect context, so that FreenectDriver can call the Freenect's C API. As a DriverBase, FreenectDriver manages devices and sets up device state callbacks. | ||
|
||
Device inherits publically from oni::driver::DeviceBase and Freenect::FreenectDevice. Because of this, it can be built by Freenect::Freenect::createDevice() and it can define Device's depth and video callbacks. Those callbacks trigger acquireFrame() in FreenectStream. | ||
|
||
VideoStream is a virtual base class inheriting from oni::driver::StreamBase. It does generic frame setup in buildFrame() and then calls pure virtual populateFrame() to let derived classes finish the frame. It also provides the base skeleton for setting and getting properties, which cascades down the inheritance tree. | ||
|
||
DepthStream and ColorStream are nearly identical in definition and implementation, both inheriting from VideoStream. They differ mostly in the formats they use to process data and the video modes they support. These two classes offer a system to store and report supported video modes. To implement a new mode, simply add it to getSupportedVideoModes() and modify populateFrame() if necessary. | ||
|
||
__________________________________________________ | ||
|
||
Todo | ||
---- | ||
* support more FREENECT_RESOLUTION_\*, FREENECT_VIDEO_\*, and FREENECT_DEPTH_\* | ||
* provide more OniVideoMode and OniStreamProperty | ||
* implement remaining derived functions |
43 changes: 43 additions & 0 deletions
43
...enectDriver/extern/OpenNI-Linux-x64-2.2.0.33/Include/Android-Arm/OniPlatformAndroid-Arm.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/***************************************************************************** | ||
* * | ||
* OpenNI 2.x Alpha * | ||
* Copyright (C) 2012 PrimeSense Ltd. * | ||
* * | ||
* This file is part of OpenNI. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); * | ||
* you may not use this file except in compliance with the License. * | ||
* You may obtain a copy of the License at * | ||
* * | ||
* http://www.apache.org/licenses/LICENSE-2.0 * | ||
* * | ||
* Unless required by applicable law or agreed to in writing, software * | ||
* distributed under the License is distributed on an "AS IS" BASIS, * | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
* See the License for the specific language governing permissions and * | ||
* limitations under the License. * | ||
* * | ||
*****************************************************************************/ | ||
#ifndef _ONI_PLATFORM_ANDROID_ARM_H_ | ||
#define _ONI_PLATFORM_ANDROID_ARM_H_ | ||
|
||
// Start with Linux-x86, and override what's different | ||
#include "../Linux-x86/OniPlatformLinux-x86.h" | ||
|
||
//--------------------------------------------------------------------------- | ||
// Platform Basic Definition | ||
//--------------------------------------------------------------------------- | ||
#undef ONI_PLATFORM | ||
#undef ONI_PLATFORM_STRING | ||
|
||
#define ONI_PLATFORM ONI_PLATFORM_ANDROID_ARM | ||
#define ONI_PLATFORM_STRING "Android-Arm" | ||
|
||
#ifdef HAVE_ANDROID_OS | ||
#define ONI_PLATFORM_ANDROID_OS | ||
|
||
#undef ONI_PLATFORM_STRING | ||
#define ONI_PLATFORM_STRING "AndroidOS-Arm" | ||
#endif | ||
|
||
#endif //_ONI_PLATFORM_LINUX_ARM_H_ |
Oops, something went wrong.