Point Cloud Library (PCL)
1.7.0
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2011, Willow Garage, Inc. 00006 * Copyright (c) 2012-, Open Perception, Inc. 00007 * 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * * Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * * Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * * Neither the name of the copyright holder(s) nor the names of its 00021 * contributors may be used to endorse or promote products derived 00022 * from this software without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00026 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00027 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00028 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00029 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00030 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00034 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 * POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 */ 00038 #include <pcl/pcl_config.h> 00039 #ifdef HAVE_OPENNI 00040 00041 #ifndef __OPENNI_IMAGE_BAYER_GRBG__ 00042 #define __OPENNI_IMAGE_BAYER_GRBG__ 00043 #include <pcl/pcl_macros.h> 00044 #include "openni_image.h" 00045 00046 namespace openni_wrapper 00047 { 00048 /** \brief This class provides methods to fill a RGB or Grayscale image buffer from underlying Bayer pattern image. 00049 * \author Suat Gedikli <gedikli@willowgarage.com> 00050 * \ingroup io 00051 */ 00052 class PCL_EXPORTS ImageBayerGRBG : public Image 00053 { 00054 public: 00055 typedef enum 00056 { 00057 Bilinear = 0, 00058 EdgeAware, 00059 EdgeAwareWeighted 00060 } DebayeringMethod; 00061 00062 ImageBayerGRBG (boost::shared_ptr<xn::ImageMetaData> image_meta_data, DebayeringMethod method) throw (); 00063 virtual ~ImageBayerGRBG () throw (); 00064 00065 inline virtual Encoding 00066 getEncoding () const 00067 { 00068 return (BAYER_GRBG); 00069 } 00070 00071 virtual void fillRGB (unsigned width, unsigned height, unsigned char* rgb_buffer, unsigned rgb_line_step = 0) const; 00072 virtual void fillGrayscale (unsigned width, unsigned height, unsigned char* gray_buffer, unsigned gray_line_step = 0) const; 00073 virtual bool isResizingSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const; 00074 inline void setDebayeringMethod (const DebayeringMethod& method) throw (); 00075 inline DebayeringMethod getDebayeringMethod () const throw (); 00076 inline static bool resizingSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height); 00077 00078 00079 protected: 00080 DebayeringMethod debayering_method_; 00081 }; 00082 00083 void 00084 ImageBayerGRBG::setDebayeringMethod (const ImageBayerGRBG::DebayeringMethod& method) throw () 00085 { 00086 debayering_method_ = method; 00087 } 00088 00089 ImageBayerGRBG::DebayeringMethod 00090 ImageBayerGRBG::getDebayeringMethod () const throw () 00091 { 00092 return debayering_method_; 00093 } 00094 00095 bool 00096 ImageBayerGRBG::resizingSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) 00097 { 00098 return (output_width <= input_width && output_height <= input_height && input_width % output_width == 0 && input_height % output_height == 0 ); 00099 } 00100 } // namespace 00101 00102 #endif 00103 #endif // __OPENNI_IMAGE__