Home | History | Annotate | Download | only in highgui
      1 Using Creative Senz3D and other Intel Perceptual Computing SDK compatible depth sensors {#tutorial_intelperc}
      2 =======================================================================================
      3 
      4 Depth sensors compatible with Intel Perceptual Computing SDK are supported through VideoCapture
      5 class. Depth map, RGB image and some other formats of output can be retrieved by using familiar
      6 interface of VideoCapture.
      7 
      8 In order to use depth sensor with OpenCV you should do the following preliminary steps:
      9 
     10 -#  Install Intel Perceptual Computing SDK (from here <http://www.intel.com/software/perceptual>).
     11 
     12 -#  Configure OpenCV with Intel Perceptual Computing SDK support by setting WITH_INTELPERC flag in
     13     CMake. If Intel Perceptual Computing SDK is found in install folders OpenCV will be built with
     14     Intel Perceptual Computing SDK library (see a status INTELPERC in CMake log). If CMake process
     15     doesn't find Intel Perceptual Computing SDK installation folder automatically, the user should
     16     change corresponding CMake variables INTELPERC_LIB_DIR and INTELPERC_INCLUDE_DIR to the
     17     proper value.
     18 
     19 -#  Build OpenCV.
     20 
     21 VideoCapture can retrieve the following data:
     22 
     23 -#  data given from depth generator:
     24     -   CAP_INTELPERC_DEPTH_MAP - each pixel is a 16-bit integer. The value indicates the
     25             distance from an object to the camera's XY plane or the Cartesian depth. (CV_16UC1)
     26     -   CAP_INTELPERC_UVDEPTH_MAP - each pixel contains two 32-bit floating point values in
     27         the range of 0-1, representing the mapping of depth coordinates to the color
     28         coordinates. (CV_32FC2)
     29     -   CAP_INTELPERC_IR_MAP - each pixel is a 16-bit integer. The value indicates the
     30         intensity of the reflected laser beam. (CV_16UC1)
     31 
     32 -#  data given from RGB image generator:
     33     -   CAP_INTELPERC_IMAGE - color image. (CV_8UC3)
     34 
     35 In order to get depth map from depth sensor use VideoCapture::operator \>\>, e. g. :
     36 @code{.cpp}
     37     VideoCapture capture( CAP_INTELPERC );
     38     for(;;)
     39     {
     40         Mat depthMap;
     41         capture >> depthMap;
     42 
     43         if( waitKey( 30 ) >= 0 )
     44             break;
     45     }
     46 @endcode
     47 For getting several data maps use VideoCapture::grab and VideoCapture::retrieve, e.g. :
     48 @code{.cpp}
     49     VideoCapture capture(CAP_INTELPERC);
     50     for(;;)
     51     {
     52         Mat depthMap;
     53         Mat image;
     54         Mat irImage;
     55 
     56         capture.grab();
     57 
     58         capture.retrieve( depthMap, CAP_INTELPERC_DEPTH_MAP );
     59         capture.retrieve(    image, CAP_INTELPERC_IMAGE );
     60         capture.retrieve(  irImage, CAP_INTELPERC_IR_MAP);
     61 
     62         if( waitKey( 30 ) >= 0 )
     63             break;
     64     }
     65 @endcode
     66 For setting and getting some property of sensor\` data generators use VideoCapture::set and
     67 VideoCapture::get methods respectively, e.g. :
     68 @code{.cpp}
     69     VideoCapture capture( CAP_INTELPERC );
     70     capture.set( CAP_INTELPERC_DEPTH_GENERATOR | CAP_PROP_INTELPERC_PROFILE_IDX, 0 );
     71     cout << "FPS    " << capture.get( CAP_INTELPERC_DEPTH_GENERATOR+CAP_PROP_FPS ) << endl;
     72 @endcode
     73 Since two types of sensor's data generators are supported (image generator and depth generator),
     74 there are two flags that should be used to set/get property of the needed generator:
     75 
     76 -   CAP_INTELPERC_IMAGE_GENERATOR -- a flag for access to the image generator properties.
     77 -   CAP_INTELPERC_DEPTH_GENERATOR -- a flag for access to the depth generator properties. This
     78     flag value is assumed by default if neither of the two possible values of the property is set.
     79 
     80 For more information please refer to the example of usage
     81 [intelperc_capture.cpp](https://github.com/Itseez/opencv/tree/master/samples/cpp/intelperc_capture.cpp)
     82 in opencv/samples/cpp folder.
     83