|
Point Cloud Library (PCL)
1.6.0
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2011 Willow Garage, Inc. 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * * Redistributions in binary form must reproduce the above 00015 * copyright notice, this list of conditions and the following 00016 * disclaimer in the documentation and/or other materials provided 00017 * with the distribution. 00018 * * Neither the name of Willow Garage, Inc. nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00032 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 #include <pcl/pcl_config.h> 00037 #ifdef HAVE_OPENNI 00038 00039 #ifndef __OPENNI_IMAGE__ 00040 #define __OPENNI_IMAGE__ 00041 00042 #include <XnCppWrapper.h> 00043 #include <pcl/pcl_exports.h> 00044 #include "openni_exception.h" 00045 #include <boost/shared_ptr.hpp> 00046 00047 namespace openni_wrapper 00048 { 00049 00058 class PCL_EXPORTS Image 00059 { 00060 public: 00061 typedef boost::shared_ptr<Image> Ptr; 00062 typedef boost::shared_ptr<const Image> ConstPtr; 00063 00064 typedef enum 00065 { 00066 BAYER_GRBG, 00067 YUV422, 00068 RGB 00069 } Encoding; 00070 00076 inline Image (boost::shared_ptr<xn::ImageMetaData> image_meta_data) throw (); 00077 00082 inline virtual ~Image () throw (); 00083 00092 virtual bool isResizingSupported (unsigned input_width, unsigned input_height, 00093 unsigned output_width, unsigned output_height) const = 0; 00094 00103 virtual void fillRGB (unsigned width, unsigned height, unsigned char* rgb_buffer, 00104 unsigned rgb_line_step = 0) const = 0; 00105 00111 virtual Encoding getEncoding () const = 0; 00112 00118 inline void 00119 fillRaw (unsigned char* rgb_buffer) const throw () 00120 { 00121 memcpy (rgb_buffer, image_md_->Data (), image_md_->DataSize ()); 00122 } 00123 00132 virtual void fillGrayscale (unsigned width, unsigned height, unsigned char* gray_buffer, 00133 unsigned gray_line_step = 0) const = 0; 00134 00139 inline unsigned getWidth () const throw (); 00140 00145 inline unsigned getHeight () const throw (); 00146 00152 inline unsigned getFrameID () const throw (); 00153 00159 inline unsigned long getTimeStamp () const throw (); 00160 00165 inline const xn::ImageMetaData& getMetaData () const throw (); 00166 00167 protected: 00168 boost::shared_ptr<xn::ImageMetaData> image_md_; 00169 } ; 00170 00171 Image::Image (boost::shared_ptr<xn::ImageMetaData> image_meta_data) throw () 00172 : image_md_ (image_meta_data) 00173 { 00174 } 00175 00176 Image::~Image () throw () { } 00177 00178 unsigned 00179 Image::getWidth () const throw () 00180 { 00181 return image_md_->XRes (); 00182 } 00183 00184 unsigned 00185 Image::getHeight () const throw () 00186 { 00187 return image_md_->YRes (); 00188 } 00189 00190 unsigned 00191 Image::getFrameID () const throw () 00192 { 00193 return image_md_->FrameID (); 00194 } 00195 00196 unsigned long 00197 Image::getTimeStamp () const throw () 00198 { 00199 return static_cast<unsigned long> (image_md_->Timestamp ()); 00200 } 00201 00202 const xn::ImageMetaData& 00203 Image::getMetaData () const throw () 00204 { 00205 return *image_md_; 00206 } 00207 } // namespace 00208 #endif 00209 #endif //__OPENNI_IMAGE__
1.7.6.1