organized_pointcloud_compression.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2010-2011, Willow Garage, Inc.
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Willow Garage, Inc. nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  * $Id$
00037  */
00038 
00039 #ifndef PCL_ORGANIZED_POINT_COMPRESSION_H_
00040 #define PCL_ORGANIZED_POINT_COMPRESSION_H_
00041 
00042 #include <pcl/pcl_macros.h>
00043 #include <pcl/point_cloud.h>
00044 
00045 #include <pcl/common/boost.h>
00046 #include <pcl/common/eigen.h>
00047 #include <pcl/common/common.h>
00048 #include <pcl/common/io.h>
00049 
00050 #include <pcl/io/openni_camera/openni_shift_to_depth_conversion.h>
00051 
00052 #include <vector>
00053 
00054 namespace pcl
00055 {
00056   namespace io
00057   {
00060     template<typename PointT>
00061     class OrganizedPointCloudCompression
00062     {
00063       public:
00064         typedef pcl::PointCloud<PointT> PointCloud;
00065         typedef boost::shared_ptr<PointCloud> PointCloudPtr;
00066         typedef boost::shared_ptr<const PointCloud> PointCloudConstPtr;
00067 
00069         OrganizedPointCloudCompression ()
00070         {
00071         }
00072 
00074         virtual ~OrganizedPointCloudCompression ()
00075         {
00076         }
00077 
00086         void encodePointCloud (const PointCloudConstPtr &cloud_arg,
00087                                std::ostream& compressedDataOut_arg,
00088                                bool doColorEncoding = false,
00089                                bool convertToMono = false,
00090                                bool bShowStatistics_arg = true,
00091                                int pngLevel_arg = -1);
00092 
00108         void encodeRawDisparityMapWithColorImage ( std::vector<uint16_t>& disparityMap_arg,
00109                                                    std::vector<uint8_t>& colorImage_arg,
00110                                                    uint32_t width_arg,
00111                                                    uint32_t height_arg,
00112                                                    std::ostream& compressedDataOut_arg,
00113                                                    bool doColorEncoding = false,
00114                                                    bool convertToMono = false,
00115                                                    bool bShowStatistics_arg = true,
00116                                                    int pngLevel_arg = -1,
00117                                                    float focalLength_arg = 525.0f,
00118                                                    float disparityShift_arg = 174.825f,
00119                                                    float disparityScale_arg = -0.161175f);
00120 
00127         bool decodePointCloud (std::istream& compressedDataIn_arg,
00128                                PointCloudPtr &cloud_arg,
00129                                bool bShowStatistics_arg = true);
00130 
00131       protected:
00137         void analyzeOrganizedCloud (PointCloudConstPtr cloud_arg,
00138                                     float& maxDepth_arg,
00139                                     float& focalLength_arg) const;
00140 
00141       private:
00142         // frame header identifier
00143         static const char* frameHeaderIdentifier_;
00144 
00145         //
00146         openni_wrapper::ShiftToDepthConverter sd_converter_;
00147     };
00148 
00149     // define frame identifier
00150     template<typename PointT>
00151     const char* OrganizedPointCloudCompression<PointT>::frameHeaderIdentifier_ = "<PCL-ORG-COMPRESSED>";
00152   }
00153 }
00154 
00155 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:21