Point Cloud Library (PCL)  1.11.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 <pcl/memory.h>
41 #include "openni.h"
42 #include "openni_exception.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 = pcl::shared_ptr<IRImage>;
55  using ConstPtr = pcl::shared_ptr<const IRImage>;
56 
57  inline IRImage (pcl::shared_ptr<xn::IRMetaData> ir_meta_data) noexcept;
58  inline virtual ~IRImage () noexcept;
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  pcl::shared_ptr<xn::IRMetaData> ir_md_;
70 };
71 
72 IRImage::IRImage (pcl::shared_ptr<xn::IRMetaData> ir_meta_data) noexcept
73 : ir_md_ (std::move(ir_meta_data))
74 {
75 }
76 
77 IRImage::~IRImage () noexcept
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__
pcl_macros.h
Defines all the PCL and non-PCL macros used.
openni_wrapper::IRImage
Class containing just a reference to IR meta data.
Definition: openni_ir_image.h:51
pcl
Definition: convolution.h:46
openni_wrapper::IRImage::getFrameID
unsigned getFrameID() const
Definition: openni_ir_image.h:91
openni_wrapper
Definition: openni_depth_image.h:51
openni_wrapper::IRImage::~IRImage
virtual ~IRImage() noexcept
Definition: openni_ir_image.h:77
openni_wrapper::IRImage::ConstPtr
pcl::shared_ptr< const IRImage > ConstPtr
Definition: openni_ir_image.h:55
openni_wrapper::IRImage::getHeight
unsigned getHeight() const
Definition: openni_ir_image.h:86
openni_wrapper::IRImage::getMetaData
const xn::IRMetaData & getMetaData() const
Definition: openni_ir_image.h:101
openni_wrapper::IRImage::getTimeStamp
unsigned long getTimeStamp() const
Definition: openni_ir_image.h:96
openni_wrapper::IRImage::getWidth
unsigned getWidth() const
Definition: openni_ir_image.h:81
openni_wrapper::IRImage::Ptr
pcl::shared_ptr< IRImage > Ptr
Definition: openni_ir_image.h:54
memory.h
Defines functions, macros and traits for allocating and using memory.
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:323