Point Cloud Library (PCL)  1.9.1
auto_io.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2009, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder(s) nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id$
35  *
36  */
37 
38 #ifndef PCL_IO_AUTO_IO_H_
39 #define PCL_IO_AUTO_IO_H_
40 
41 #include <pcl/pcl_macros.h>
42 #include <pcl/common/io.h>
43 #include <pcl/io/boost.h>
44 #include <cmath>
45 #include <sstream>
46 #include <pcl/PolygonMesh.h>
47 #include <pcl/TextureMesh.h>
48 
49 namespace pcl
50 {
51 
52  namespace io
53  {
54  /** \brief Load a file into a PointCloud2 according to extension.
55  * \param[in] file_name the name of the file to load
56  * \param[out] blob the resultant pcl::PointCloud2 blob
57  * \ingroup io
58  */
59  PCL_EXPORTS int
60  load (const std::string& file_name, pcl::PCLPointCloud2& blob);
61 
62  /** \brief Load a file into a template PointCloud type according to extension.
63  * \param[in] file_name the name of the file to load
64  * \param[out] cloud the resultant templated point cloud
65  * \ingroup io
66  */
67  template<typename PointT> int
68  load (const std::string& file_name, pcl::PointCloud<PointT>& cloud);
69 
70  /** \brief Load a file into a PolygonMesh according to extension.
71  * \param[in] file_name the name of the file to load
72  * \param[out] mesh the resultant pcl::PolygonMesh
73  * \ingroup io
74  */
75  PCL_EXPORTS int
76  load (const std::string& file_name, pcl::PolygonMesh& mesh);
77 
78  /** \brief Load a file into a TextureMesh according to extension.
79  * \param[in] file_name the name of the file to load
80  * \param[out] mesh the resultant pcl::TextureMesh
81  * \ingroup io
82  */
83  PCL_EXPORTS int
84  load (const std::string& file_name, pcl::TextureMesh& mesh);
85 
86  /** \brief Save point cloud data to a binary file when available else to ASCII.
87  * \param[in] file_name the output file name
88  * \param[in] blob the point cloud data message
89  * \param[in] precision float precision when saving to ASCII files
90  * \ingroup io
91  */
92  PCL_EXPORTS int
93  save (const std::string& file_name, const pcl::PCLPointCloud2& blob, unsigned precision = 5);
94 
95  /** \brief Save point cloud to a binary file when available else to ASCII.
96  * \param[in] file_name the output file name
97  * \param[in] cloud the point cloud
98  * \ingroup io
99  */
100  template<typename PointT> int
101  save (const std::string& file_name, const pcl::PointCloud<PointT>& cloud);
102 
103  /** \brief Saves a TextureMesh to a binary file when available else to ASCII.
104  * \param[in] file_name the name of the file to write to disk
105  * \param[in] tex_mesh the texture mesh to save
106  * \param[in] precision float precision when saving to ASCII files
107  * \ingroup io
108  */
109  PCL_EXPORTS int
110  save (const std::string &file_name, const pcl::TextureMesh &tex_mesh, unsigned precision = 5);
111 
112  /** \brief Saves a PolygonMesh to a binary file when available else to ASCII.
113  * \param[in] file_name the name of the file to write to disk
114  * \param[in] mesh the polygonal mesh to save
115  * \param[in] precision float precision when saving to ASCII files
116  * \ingroup io
117  */
118  PCL_EXPORTS int
119  save (const std::string &file_name, const pcl::PolygonMesh &mesh, unsigned precision = 5);
120  }
121 }
122 
123 #include <pcl/io/impl/auto_io.hpp>
124 
125 #endif //#ifndef PCL_IO_AUTO_IO_H_
PCL_EXPORTS int load(const std::string &file_name, pcl::PCLPointCloud2 &blob)
Load a file into a PointCloud2 according to extension.
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
PointCloud represents the base class in PCL for storing collections of 3D points. ...
PCL_EXPORTS int save(const std::string &file_name, const pcl::PCLPointCloud2 &blob, unsigned precision=5)
Save point cloud data to a binary file when available else to ASCII.