Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
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 }
00208 #endif
00209 #endif //__OPENNI_IMAGE__