openni_depth_image.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011 Willow Garage, Inc.
00005  *    Suat Gedikli <gedikli@willowgarage.com>
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Willow Garage, Inc. nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  */
00037 #ifndef __OPENNI_DEPTH_IMAGE__
00038 #define __OPENNI_DEPTH_IMAGE__
00039 
00040 #include <XnCppWrapper.h>
00041 
00042 #include "openni_exception.h"
00043 #include <boost/shared_ptr.hpp>
00044 
00045 namespace openni_wrapper
00046 {
00052 class DepthImage
00053 {
00054 public:
00055   typedef boost::shared_ptr<DepthImage> Ptr;
00056   typedef boost::shared_ptr<const DepthImage> ConstPtr;
00057 
00058   inline DepthImage (boost::shared_ptr<xn::DepthMetaData> depth_meta_data, float baseline, float focal_length, XnUInt64 shadow_value, XnUInt64 no_sample_value) throw ();
00059   inline virtual ~DepthImage () throw ();
00060 
00061   inline const xn::DepthMetaData& getDepthMetaData () const throw ();
00062   void fillDisparityImage (unsigned width, unsigned height, float* disparity_buffer, unsigned line_step = 0) const throw (OpenNIException);
00063   void fillDepthImage (unsigned width, unsigned height, float* depth_buffer, unsigned line_step = 0) const throw (OpenNIException);
00064   void fillDepthImageRaw (unsigned width, unsigned height, unsigned short* depth_buffer, unsigned line_step = 0) const throw (OpenNIException);
00065 
00066   inline float getBaseline () const throw ();
00067   inline float getFocalLength () const throw ();
00068   inline XnUInt64 getShadowValue () const throw ();
00069   inline XnUInt64 getNoSampleValue () const throw ();
00070   inline unsigned getWidth () const throw ();
00071   inline unsigned getHeight () const throw ();
00072   inline unsigned getFrameID () const throw ();
00073   inline unsigned long getTimeStamp () const throw ();
00074 protected:
00075   boost::shared_ptr<xn::DepthMetaData> depth_md_;
00076   float baseline_;
00077   float focal_length_;
00078   XnUInt64 shadow_value_;
00079   XnUInt64 no_sample_value_;
00080 };
00081 
00082 DepthImage::DepthImage (boost::shared_ptr<xn::DepthMetaData> depth_meta_data, float baseline, float focal_length, XnUInt64 shadow_value, XnUInt64 no_sample_value) throw ()
00083 : depth_md_ (depth_meta_data)
00084 , baseline_ (baseline)
00085 , focal_length_ (focal_length)
00086 , shadow_value_ (shadow_value)
00087 , no_sample_value_ (no_sample_value)
00088 {
00089 }
00090 
00091 DepthImage::~DepthImage () throw ()
00092 {
00093 }
00094 
00095 const xn::DepthMetaData& DepthImage::getDepthMetaData () const throw ()
00096 {
00097   return *depth_md_;
00098 }
00099 
00100 float DepthImage::getBaseline () const throw ()
00101 {
00102   return baseline_;
00103 }
00104 
00105 float DepthImage::getFocalLength () const throw ()
00106 {
00107   return focal_length_;
00108 }
00109 
00110 XnUInt64 DepthImage::getShadowValue () const throw ()
00111 {
00112   return shadow_value_;
00113 }
00114 
00115 XnUInt64 DepthImage::getNoSampleValue () const throw ()
00116 {
00117   return no_sample_value_;
00118 }
00119 
00120 unsigned DepthImage::getWidth () const throw ()
00121 {
00122   return depth_md_->XRes ();
00123 }
00124 
00125 unsigned DepthImage::getHeight () const throw ()
00126 {
00127   return depth_md_->YRes ();
00128 }
00129 
00130 unsigned DepthImage::getFrameID () const throw ()
00131 {
00132   return depth_md_->FrameID ();
00133 }
00134 
00135 unsigned long DepthImage::getTimeStamp () const throw ()
00136 {
00137   return (unsigned long) depth_md_->Timestamp ();
00138 }
00139 } // namespace
00140 #endif //__OPENNI_DEPTH_IMAGE


openni_camera
Author(s): Patrick Mihelich, Suat Gedikli, Radu Bogdan Rusu
autogenerated on Thu Jun 6 2019 20:16:13