Point Cloud Library (PCL)  1.14.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 noexcept;
63  inline unsigned getHeight () const noexcept;
64  inline unsigned getFrameID () const noexcept;
65  inline unsigned long getTimeStamp () const noexcept;
66  inline const xn::IRMetaData& getMetaData () const noexcept;
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 = default;
78 
79 unsigned IRImage::getWidth () const noexcept
80 {
81  return ir_md_->XRes ();
82 }
83 
84 unsigned IRImage::getHeight () const noexcept
85 {
86  return ir_md_->YRes ();
87 }
88 
89 unsigned IRImage::getFrameID () const noexcept
90 {
91  return ir_md_->FrameID ();
92 }
93 
94 unsigned long IRImage::getTimeStamp () const noexcept
95 {
96  return static_cast<unsigned long> (ir_md_->Timestamp ());
97 }
98 
99 const xn::IRMetaData& IRImage::getMetaData () const noexcept
100 {
101  return *ir_md_;
102 }
103 } // namespace
104 #endif //__OPENNI_IR_IMAGE__
Class containing just a reference to IR meta data.
pcl::shared_ptr< IRImage > Ptr
virtual ~IRImage() noexcept
unsigned long getTimeStamp() const noexcept
pcl::shared_ptr< const IRImage > ConstPtr
unsigned getFrameID() const noexcept
unsigned getHeight() const noexcept
const xn::IRMetaData & getMetaData() const noexcept
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
#define PCL_EXPORTS
Definition: pcl_macros.h:323