Openni2 support
authorLars Glud <larshg@gmail.com>
Sun, 20 Jul 2014 12:49:47 +0000 (14:49 +0200)
committerLars Glud <larshg@gmail.com>
Sun, 20 Jul 2014 13:04:11 +0000 (15:04 +0200)
modules/highgui/CMakeLists.txt
modules/highgui/include/opencv2/highgui.hpp
modules/highgui/include/opencv2/highgui/highgui_c.h
modules/videoio/CMakeLists.txt
modules/videoio/include/opencv2/videoio.hpp
modules/videoio/include/opencv2/videoio/videoio_c.h
modules/videoio/src/cap_openni2.cpp [moved from modules/highgui/src/cap_openni2.cpp with 99% similarity]

index a80fe04..b0c93a8 100644 (file)
@@ -72,12 +72,6 @@ elseif(HAVE_COCOA)
   list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa")
 endif()
 
-if(HAVE_OPENNI2)
-  list(APPEND highgui_srcs src/cap_openni2.cpp)
-  ocv_include_directories(${OPENNI2_INCLUDE_DIR})
-  list(APPEND HIGHGUI_LIBRARIES ${OPENNI2_LIBRARY})
-endif(HAVE_OPENNI2)
-
 if(UNIX)
   #these variables are set by CHECK_MODULE macro
   foreach(P ${HIGHGUI_INCLUDE_DIRS})
index b235190..47b6547 100644 (file)
@@ -201,9 +201,4 @@ CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
                              bool initial_button_state = false);
 
 } // cv
-
-       CAP_OPENNI2      = 1600   // OpenNI2 (for Kinect)
-    CAP_PROP_OPENNI_OUTPUT_MODE       = 100,
-    CAP_PROP_OPENNI2_SYNC             = 110,
-    CAP_PROP_OPENNI2_MIRROR           = 111
 #endif
index 34c811d..f45a710 100644 (file)
@@ -208,10 +208,6 @@ CVAPI(void) cvUpdateWindow(const char* window_name);
 
 /****************************************************************************************\
 
-
-    CV_CAP_OPENNI2 = 1600   // OpenNI2 (for Kinect)
-    CV_CAP_PROP_OPENNI2_SYNC = 110,
-    CV_CAP_PROP_OPENNI2_MIRROR = 111,
 *                              Obsolete functions/synonyms                               *
 \****************************************************************************************/
 
index 2ac7811..bba3d33 100644 (file)
@@ -78,6 +78,12 @@ if(HAVE_OPENNI)
   list(APPEND VIDEOIO_LIBRARIES ${OPENNI_LIBRARY})
 endif(HAVE_OPENNI)
 
+if(HAVE_OPENNI2)
+  list(APPEND videoio_srcs src/cap_openni2.cpp)
+  ocv_include_directories(${OPENNI2_INCLUDE_DIR})
+  list(APPEND VIDEOIO_LIBRARIES ${OPENNI2_LIBRARY})
+endif(HAVE_OPENNI2)
+
 if(HAVE_opencv_androidcamera)
   list(APPEND videoio_srcs src/cap_android.cpp)
   add_definitions(-DHAVE_ANDROID_NATIVE_CAMERA)#TODO: remove this line
index a144c65..763c5bd 100644 (file)
@@ -75,7 +75,8 @@ enum { CAP_ANY          = 0,     // autodetect
        CAP_AVFOUNDATION = 1200,  // AVFoundation framework for iOS (OS X Lion will have the same API)
        CAP_GIGANETIX    = 1300,  // Smartek Giganetix GigEVisionSDK
        CAP_MSMF         = 1400,  // Microsoft Media Foundation (via videoInput)
-       CAP_INTELPERC    = 1500   // Intel Perceptual Computing SDK
+       CAP_INTELPERC    = 1500,   // Intel Perceptual Computing SDK
+       CAP_OPENNI2      = 1600   // OpenNI2 (for Kinect)
      };
 
 // generic properties (based on DC1394 properties)
@@ -149,7 +150,9 @@ enum { CAP_PROP_OPENNI_OUTPUT_MODE       = 100,
        CAP_PROP_OPENNI_MAX_BUFFER_SIZE   = 106,
        CAP_PROP_OPENNI_CIRCLE_BUFFER     = 107,
        CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
-       CAP_PROP_OPENNI_GENERATOR_PRESENT = 109
+       CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
+       CAP_PROP_OPENNI2_SYNC             = 110,
+       CAP_PROP_OPENNI2_MIRROR           = 111
      };
 
 // OpenNI shortcats
index 85cb07c..0b08d03 100644 (file)
@@ -104,7 +104,9 @@ enum
 
     CV_CAP_GIGANETIX = 1300,  // Smartek Giganetix GigEVisionSDK
 
-    CV_CAP_INTELPERC = 1500 // Intel Perceptual Computing SDK
+    CV_CAP_INTELPERC = 1500, // Intel Perceptual Computing
+
+    CV_CAP_OPENNI2 = 1600   // OpenNI2 (for Kinect)
 };
 
 /* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
@@ -200,6 +202,8 @@ enum
     CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
 
     CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
+    CV_CAP_PROP_OPENNI2_SYNC = 110,
+    CV_CAP_PROP_OPENNI2_MIRROR = 111,
 
     CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT         = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT,
     CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE     = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE,
similarity index 99%
rename from modules/highgui/src/cap_openni2.cpp
rename to modules/videoio/src/cap_openni2.cpp
index 4d12e5e..62aacb2 100644 (file)
@@ -481,7 +481,7 @@ bool CvCapture_OpenNI2::setCommonProperty( int propIdx, double propValue )
     {
     case CV_CAP_PROP_OPENNI2_MIRROR:
     {
-        bool mirror = propValue > 0 ? true : false;
+        bool mirror = propValue > 0.0 ? true : false;
         isSet = color.setMirroringEnabled(mirror) == openni::STATUS_OK;
         isSet = depth.setMirroringEnabled(mirror) == openni::STATUS_OK;
     }
@@ -492,7 +492,7 @@ bool CvCapture_OpenNI2::setCommonProperty( int propIdx, double propValue )
         isSet = setDepthGeneratorProperty( propIdx, propValue );
         break;
     case CV_CAP_PROP_OPENNI2_SYNC:
-        isSet = device.setDepthColorSyncEnabled(propValue) == openni::STATUS_OK;
+        isSet = device.setDepthColorSyncEnabled(propValue > 0.0) == openni::STATUS_OK;
         break;
     default:
         CV_Error( CV_StsBadArg, cv::format("Such parameter (propIdx=%d) isn't supported for setting.\n", propIdx) );