Skip to content

Commit

Permalink
Merge tag 'v0.3.0' into dfsg
Browse files Browse the repository at this point in the history
libfreenect v0.3.0 Nucleus

* tag 'v0.3.0':
  Update CMakeLists.txt for v0.3.0
  OpenNI2-FreenectDriver: update README.md
  OpenNI2-FreenectDriver: OFF by default; pass -DBUILD_OPENNI2_DRIVER=ON to cmake to enable
  OpenNI2-FreenectDriver: support ONI_STREAM_PROPERTY_AUTO_WHITE_BALANCE and ONI_STREAM_PROPERTY_AUTO_EXPOSURE
  OpenNI2-FreenectDriver: reduce compiler warnings
  Added chunk processing callbacks for depth and video streams - fixes OpenKinect#351
  Fix missing semicolon in fakenect/record.c
  wrappers/cpp: Remove pureness from virtual callbacks - fixes OpenKinect#286
  Update CMakeLists.txt for v0.2.1
  wrappers/cpp: replace std::make_pair with and more compatible assignment - fixes OpenKinect#339
  wrappers/cpp: Stop loop before clearing devices (prevents hang on exit) - fixes OpenKinect#295
  OpenNI2-FreenectDriver: initial commit
  fakenect: Fix memory leaks - fixes OpenKinect#205
  csharp: Update Enumerations.cs - fixes OpenKinect#285
  Tweaks to freenect_flag commit
  Fix include of libusb.h in wrappers/cpp/libfreenect.hpp
  Make freenect_flags an actual flag enum
  Added Gentoo Linux ebuilds
  Added error reporting for failed subdevice initialization.
  Added a feature to use accelerometer data to rotate camera view in software when the camera is physically rotated such that the view on the screen is always upright even when the camera is upside down. Enabling it, and disabling it is done with the "r" key. Not on by default. I enabled several things that were disabled in the last patch, but only when rotation mode is toggled on.
  • Loading branch information
yarikoptic committed Oct 27, 2014
2 parents 6198bcd + 300faff commit bea088d
Show file tree
Hide file tree
Showing 45 changed files with 8,576 additions and 69 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cmake_minimum_required(VERSION 2.6)
PROJECT(libfreenect)

set (PROJECT_VER_MAJOR 0)
set (PROJECT_VER_MINOR 2)
set (PROJECT_VER_MINOR 3)
set (PROJECT_VER_PATCH 0)
set (PROJECT_VER
"${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
Expand All @@ -57,6 +57,7 @@ OPTION(BUILD_CPP "Build C++ Library (currently header only)" ON)
OPTION(BUILD_CV "Build OpenCV wrapper" OFF)
OPTION(BUILD_AS3_SERVER "Build the Actionscript 3 Server Example" OFF)
OPTION(BUILD_PYTHON "Build Python extension" OFF)
OPTION(BUILD_OPENNI2_DRIVER "Build libfreenect driver for OpenNI2" OFF)
IF(PROJECT_OS_LINUX)
OPTION(BUILD_CPACK "Build an RPM or DEB using CPack" OFF)
ENDIF(PROJECT_OS_LINUX)
Expand Down Expand Up @@ -153,6 +154,10 @@ IF(BUILD_PYTHON)
add_subdirectory (wrappers/python)
ENDIF()

IF(BUILD_OPENNI2_DRIVER)
add_subdirectory(OpenNI2-FreenectDriver)
ENDIF()

######################################################################################
# Extras
######################################################################################
Expand Down
22 changes: 22 additions & 0 deletions OpenNI2-FreenectDriver/CMakeLists.txt
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")
47 changes: 47 additions & 0 deletions OpenNI2-FreenectDriver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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. Go to your build directory and 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 dependencies listed in `ldd libFreenectDriver.so`.

__________________________________________________

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
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_
Loading

0 comments on commit bea088d

Please sign in to comment.