openni_depth_image.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011 Willow Garage, Inc.
5  * Suat Gedikli <gedikli@willowgarage.com>
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 #ifndef __OPENNI_DEPTH_IMAGE__
38 #define __OPENNI_DEPTH_IMAGE__
39 
40 #include <XnCppWrapper.h>
41 
42 #include "openni_exception.h"
43 #include <boost/shared_ptr.hpp>
44 
45 namespace openni_wrapper
46 {
53 {
54 public:
57 
58  inline DepthImage (boost::shared_ptr<xn::DepthMetaData> depth_meta_data, float baseline, float focal_length, XnUInt64 shadow_value, XnUInt64 no_sample_value) throw ();
59  inline virtual ~DepthImage () throw ();
60 
61  inline const xn::DepthMetaData& getDepthMetaData () const throw ();
62  void fillDisparityImage (unsigned width, unsigned height, float* disparity_buffer, unsigned line_step = 0) const throw (OpenNIException);
63  void fillDepthImage (unsigned width, unsigned height, float* depth_buffer, unsigned line_step = 0) const throw (OpenNIException);
64  void fillDepthImageRaw (unsigned width, unsigned height, unsigned short* depth_buffer, unsigned line_step = 0) const throw (OpenNIException);
65 
66  inline float getBaseline () const throw ();
67  inline float getFocalLength () const throw ();
68  inline XnUInt64 getShadowValue () const throw ();
69  inline XnUInt64 getNoSampleValue () const throw ();
70  inline unsigned getWidth () const throw ();
71  inline unsigned getHeight () const throw ();
72  inline unsigned getFrameID () const throw ();
73  inline unsigned long getTimeStamp () const throw ();
74 protected:
75  boost::shared_ptr<xn::DepthMetaData> depth_md_;
76  float baseline_;
78  XnUInt64 shadow_value_;
79  XnUInt64 no_sample_value_;
80 };
81 
82 DepthImage::DepthImage (boost::shared_ptr<xn::DepthMetaData> depth_meta_data, float baseline, float focal_length, XnUInt64 shadow_value, XnUInt64 no_sample_value) throw ()
83 : depth_md_ (depth_meta_data)
84 , baseline_ (baseline)
85 , focal_length_ (focal_length)
86 , shadow_value_ (shadow_value)
87 , no_sample_value_ (no_sample_value)
88 {
89 }
90 
92 {
93 }
94 
95 const xn::DepthMetaData& DepthImage::getDepthMetaData () const throw ()
96 {
97  return *depth_md_;
98 }
99 
100 float DepthImage::getBaseline () const throw ()
101 {
102  return baseline_;
103 }
104 
105 float DepthImage::getFocalLength () const throw ()
106 {
107  return focal_length_;
108 }
109 
110 XnUInt64 DepthImage::getShadowValue () const throw ()
111 {
112  return shadow_value_;
113 }
114 
115 XnUInt64 DepthImage::getNoSampleValue () const throw ()
116 {
117  return no_sample_value_;
118 }
119 
120 unsigned DepthImage::getWidth () const throw ()
121 {
122  return depth_md_->XRes ();
123 }
124 
125 unsigned DepthImage::getHeight () const throw ()
126 {
127  return depth_md_->YRes ();
128 }
129 
130 unsigned DepthImage::getFrameID () const throw ()
131 {
132  return depth_md_->FrameID ();
133 }
134 
135 unsigned long DepthImage::getTimeStamp () const throw ()
136 {
137  return (unsigned long) depth_md_->Timestamp ();
138 }
139 } // namespace
140 #endif //__OPENNI_DEPTH_IMAGE
DepthImage(boost::shared_ptr< xn::DepthMetaData > depth_meta_data, float baseline, float focal_length, XnUInt64 shadow_value, XnUInt64 no_sample_value)
const xn::DepthMetaData & getDepthMetaData() const
void fillDepthImage(unsigned width, unsigned height, float *depth_buffer, unsigned line_step=0) const
General exception class.
XnUInt64 getNoSampleValue() const
boost::shared_ptr< const DepthImage > ConstPtr
void fillDepthImageRaw(unsigned width, unsigned height, unsigned short *depth_buffer, unsigned line_step=0) const
unsigned long getTimeStamp() const
boost::shared_ptr< DepthImage > Ptr
XnUInt64 getShadowValue() const
void fillDisparityImage(unsigned width, unsigned height, float *disparity_buffer, unsigned line_step=0) const
This class provides methods to fill a depth or disparity image.
boost::shared_ptr< xn::DepthMetaData > depth_md_


openni_camera
Author(s): Patrick Mihelich, Suat Gedikli, Radu Bogdan Rusu
autogenerated on Wed Jun 5 2019 20:15:22