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