Point Cloud Library (PCL)  1.10.0-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 <pcl/make_shared.h>
41 #include "openni.h"
42 #include "openni_exception.h"
43 #include <pcl/io/boost.h>
44 
45 namespace openni_wrapper
46 {
47 
48 /**
49  * @brief Class containing just a reference to IR meta data.
50  * @author Patrick Mihelich <mihelich@willowgarage.com>, Suat Gedikli <gedikli@willowgarage.com>
51  */
53 {
54 public:
57 
58  inline IRImage (pcl::shared_ptr<xn::IRMetaData> ir_meta_data) noexcept;
59  inline virtual ~IRImage () noexcept;
60 
61  void fillRaw (unsigned width, unsigned height, unsigned short* ir_buffer, unsigned line_step = 0) const;
62 
63  inline unsigned getWidth () const throw ();
64  inline unsigned getHeight () const throw ();
65  inline unsigned getFrameID () const throw ();
66  inline unsigned long getTimeStamp () const throw ();
67  inline const xn::IRMetaData& getMetaData () const throw ();
68 
69 protected:
70  pcl::shared_ptr<xn::IRMetaData> ir_md_;
71 };
72 
73 IRImage::IRImage (pcl::shared_ptr<xn::IRMetaData> ir_meta_data) noexcept
74 : ir_md_ (std::move(ir_meta_data))
75 {
76 }
77 
78 IRImage::~IRImage () noexcept
79 {
80 }
81 
82 unsigned IRImage::getWidth () const throw ()
83 {
84  return ir_md_->XRes ();
85 }
86 
87 unsigned IRImage::getHeight () const throw ()
88 {
89  return ir_md_->YRes ();
90 }
91 
92 unsigned IRImage::getFrameID () const throw ()
93 {
94  return ir_md_->FrameID ();
95 }
96 
97 unsigned long IRImage::getTimeStamp () const throw ()
98 {
99  return static_cast<unsigned long> (ir_md_->Timestamp ());
100 }
101 
102 const xn::IRMetaData& IRImage::getMetaData () const throw ()
103 {
104  return *ir_md_;
105 }
106 } // namespace
107 #endif //__OPENNI_IR_IMAGE__
const xn::IRMetaData & getMetaData() const
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
pcl::shared_ptr< IRImage > Ptr
virtual ~IRImage() noexcept
unsigned getFrameID() const
pcl::shared_ptr< const IRImage > ConstPtr
unsigned getWidth() const
unsigned getHeight() const
Class containing just a reference to IR meta data.
unsigned long getTimeStamp() const
boost::shared_ptr< T > shared_ptr
Alias for boost::shared_ptr.
Definition: pcl_macros.h:90
#define PCL_EXPORTS
Definition: pcl_macros.h:253
Defines all the PCL and non-PCL macros used.