Point Cloud Library (PCL)  1.10.0
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 #pragma once
39 
40 #include <pcl/pcl_macros.h>
41 #include <pcl/common/io.h>
42 #include <pcl/io/boost.h>
43 #include <cmath>
44 #include <sstream>
45 #include <pcl/PolygonMesh.h>
46 #include <pcl/TextureMesh.h>
47 
48 namespace pcl
49 {
50 
51  namespace io
52  {
53  /** \brief Load a file into a PointCloud2 according to extension.
54  * \param[in] file_name the name of the file to load
55  * \param[out] blob the resultant pcl::PointCloud2 blob
56  * \ingroup io
57  */
58  PCL_EXPORTS int
59  load (const std::string& file_name, pcl::PCLPointCloud2& blob);
60 
61  /** \brief Load a file into a template PointCloud type according to extension.
62  * \param[in] file_name the name of the file to load
63  * \param[out] cloud the resultant templated point cloud
64  * \ingroup io
65  */
66  template<typename PointT> int
67  load (const std::string& file_name, pcl::PointCloud<PointT>& cloud);
68 
69  /** \brief Load a file into a PolygonMesh according to extension.
70  * \param[in] file_name the name of the file to load
71  * \param[out] mesh the resultant pcl::PolygonMesh
72  * \ingroup io
73  */
74  PCL_EXPORTS int
75  load (const std::string& file_name, pcl::PolygonMesh& mesh);
76 
77  /** \brief Load a file into a TextureMesh according to extension.
78  * \param[in] file_name the name of the file to load
79  * \param[out] mesh the resultant pcl::TextureMesh
80  * \ingroup io
81  */
82  PCL_EXPORTS int
83  load (const std::string& file_name, pcl::TextureMesh& mesh);
84 
85  /** \brief Save point cloud data to a binary file when available else to ASCII.
86  * \param[in] file_name the output file name
87  * \param[in] blob the point cloud data message
88  * \param[in] precision float precision when saving to ASCII files
89  * \ingroup io
90  */
91  PCL_EXPORTS int
92  save (const std::string& file_name, const pcl::PCLPointCloud2& blob, unsigned precision = 5);
93 
94  /** \brief Save point cloud to a binary file when available else to ASCII.
95  * \param[in] file_name the output file name
96  * \param[in] cloud the point cloud
97  * \ingroup io
98  */
99  template<typename PointT> int
100  save (const std::string& file_name, const pcl::PointCloud<PointT>& cloud);
101 
102  /** \brief Saves a TextureMesh to a binary file when available else to ASCII.
103  * \param[in] file_name the name of the file to write to disk
104  * \param[in] tex_mesh the texture mesh to save
105  * \param[in] precision float precision when saving to ASCII files
106  * \ingroup io
107  */
108  PCL_EXPORTS int
109  save (const std::string &file_name, const pcl::TextureMesh &tex_mesh, unsigned precision = 5);
110 
111  /** \brief Saves a PolygonMesh to a binary file when available else to ASCII.
112  * \param[in] file_name the name of the file to write to disk
113  * \param[in] mesh the polygonal mesh to save
114  * \param[in] precision float precision when saving to ASCII files
115  * \ingroup io
116  */
117  PCL_EXPORTS int
118  save (const std::string &file_name, const pcl::PolygonMesh &mesh, unsigned precision = 5);
119  }
120 }
121 
122 #include <pcl/io/impl/auto_io.hpp>
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: projection_matrix.h:52
pcl::PolygonMesh
Definition: PolygonMesh.h:15
pcl::PCLPointCloud2
Definition: PCLPointCloud2.h:19
pcl::TextureMesh
Definition: TextureMesh.h:88
pcl::io::save
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.
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:253
pcl::io::load
PCL_EXPORTS int load(const std::string &file_name, pcl::PCLPointCloud2 &blob)
Load a file into a PointCloud2 according to extension.