Point Cloud Library (PCL)  1.9.1-dev
openni_ir_image.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011 Willow Garage, Inc.
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the copyright holder(s) nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  */
36 #ifndef __OPENNI_IR_IMAGE__
37 #define __OPENNI_IR_IMAGE__
38 
39 #include <pcl/pcl_macros.h>
40 #include "openni.h"
41 #include "openni_exception.h"
42 #include <pcl/io/boost.h>
43 
44 namespace openni_wrapper
45 {
46 
47 /**
48  * @brief Class containing just a reference to IR meta data.
49  * @author Patrick Mihelich <mihelich@willowgarage.com>, Suat Gedikli <gedikli@willowgarage.com>
50  */
52 {
53 public:
54  using Ptr = boost::shared_ptr<IRImage>;
55  using ConstPtr = boost::shared_ptr<const IRImage>;
56 
57  inline IRImage (boost::shared_ptr<xn::IRMetaData> ir_meta_data) throw ();
58  inline virtual ~IRImage () throw ();
59 
60  void fillRaw (unsigned width, unsigned height, unsigned short* ir_buffer, unsigned line_step = 0) const;
61 
62  inline unsigned getWidth () const throw ();
63  inline unsigned getHeight () const throw ();
64  inline unsigned getFrameID () const throw ();
65  inline unsigned long getTimeStamp () const throw ();
66  inline const xn::IRMetaData& getMetaData () const throw ();
67 
68 protected:
69  boost::shared_ptr<xn::IRMetaData> ir_md_;
70 };
71 
72 IRImage::IRImage (boost::shared_ptr<xn::IRMetaData> ir_meta_data) throw ()
73 : ir_md_ (std::move(ir_meta_data))
74 {
75 }
76 
77 IRImage::~IRImage () throw ()
78 {
79 }
80 
81 unsigned IRImage::getWidth () const throw ()
82 {
83  return ir_md_->XRes ();
84 }
85 
86 unsigned IRImage::getHeight () const throw ()
87 {
88  return ir_md_->YRes ();
89 }
90 
91 unsigned IRImage::getFrameID () const throw ()
92 {
93  return ir_md_->FrameID ();
94 }
95 
96 unsigned long IRImage::getTimeStamp () const throw ()
97 {
98  return static_cast<unsigned long> (ir_md_->Timestamp ());
99 }
100 
101 const xn::IRMetaData& IRImage::getMetaData () const throw ()
102 {
103  return *ir_md_;
104 }
105 } // namespace
106 #endif //__OPENNI_IR_IMAGE__
const xn::IRMetaData & getMetaData() const
boost::shared_ptr< IRImage > Ptr
boost::shared_ptr< const IRImage > ConstPtr
unsigned getFrameID() const
unsigned getWidth() const
unsigned getHeight() const
Class containing just a reference to IR meta data.
unsigned long getTimeStamp() const
#define PCL_EXPORTS
Definition: pcl_macros.h:226
Defines all the PCL and non-PCL macros used.