|
Point Cloud Library (PCL)
1.5.1
|
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 "openni_exception.h" 00044 #include <boost/shared_ptr.hpp> 00045 00046 namespace openni_wrapper 00047 { 00048 00057 class Image 00058 { 00059 public: 00060 typedef boost::shared_ptr<Image> Ptr; 00061 typedef boost::shared_ptr<const Image> ConstPtr; 00062 00063 typedef enum 00064 { 00065 BAYER_GRBG, 00066 YUV422, 00067 RGB 00068 } Encoding; 00069 00075 inline Image (boost::shared_ptr<xn::ImageMetaData> image_meta_data) throw (); 00076 00081 inline virtual ~Image () throw (); 00082 00091 virtual bool isResizingSupported (unsigned input_width, unsigned input_height, 00092 unsigned output_width, unsigned output_height) const = 0; 00093 00102 virtual void fillRGB (unsigned width, unsigned height, unsigned char* rgb_buffer, 00103 unsigned rgb_line_step = 0) const = 0; 00104 00110 virtual Encoding getEncoding () const = 0; 00111 00117 inline void 00118 fillRaw (unsigned char* rgb_buffer) const throw () 00119 { 00120 memcpy (rgb_buffer, image_md_->Data (), image_md_->DataSize ()); 00121 } 00122 00131 virtual void fillGrayscale (unsigned width, unsigned height, unsigned char* gray_buffer, 00132 unsigned gray_line_step = 0) const = 0; 00133 00138 inline unsigned getWidth () const throw (); 00139 00144 inline unsigned getHeight () const throw (); 00145 00151 inline unsigned getFrameID () const throw (); 00152 00158 inline unsigned long getTimeStamp () const throw (); 00159 00164 inline const xn::ImageMetaData& getMetaData () const throw (); 00165 00166 protected: 00167 boost::shared_ptr<xn::ImageMetaData> image_md_; 00168 } ; 00169 00170 Image::Image (boost::shared_ptr<xn::ImageMetaData> image_meta_data) throw () 00171 : image_md_ (image_meta_data) { } 00172 00173 Image::~Image () throw () { } 00174 00175 unsigned 00176 Image::getWidth () const throw () 00177 { 00178 return image_md_->XRes (); 00179 } 00180 00181 unsigned 00182 Image::getHeight () const throw () 00183 { 00184 return image_md_->YRes (); 00185 } 00186 00187 unsigned 00188 Image::getFrameID () const throw () 00189 { 00190 return image_md_->FrameID (); 00191 } 00192 00193 unsigned long 00194 Image::getTimeStamp () const throw () 00195 { 00196 return (unsigned long) image_md_->Timestamp (); 00197 } 00198 00199 const xn::ImageMetaData& 00200 Image::getMetaData () const throw () 00201 { 00202 return *image_md_; 00203 } 00204 } // namespace 00205 #endif 00206 #endif //__OPENNI_IMAGE__
1.8.0