convert.cpp
Go to the documentation of this file.
1 // kate: replace-tabs off; indent-width 4; indent-mode normal
2 // vim: ts=4:sw=4:noexpandtab
3 /*
4 
5 Copyright (c) 2010--2012,
6 François Pomerleau and Stephane Magnenat, ASL, ETHZ, Switzerland
7 You can contact the authors at <f dot pomerleau at gmail dot com> and
8 <stephane at magnenat dot net>
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of the <organization> nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
37 #include <cassert>
38 #include <iostream>
39 #include <fstream>
40 
41 using namespace std;
42 using namespace PointMatcherSupport;
43 
45 typedef PM::DataPoints DP;
46 
47 void usage(char *argv[])
48 {
49  cerr << "Usage " << argv[0] << " [CONFIG.yaml] INPUT.csv/.vtk/.ply OUTPUT.csv/.vtk/.ply" << endl;
50  cerr << endl << "Example:" << endl;
51  cerr << argv[0] << " ../examples/data/default-convert.yaml ../examples/data/cloud.00000.vtk /tmp/output.vtk" << endl << endl;
52  cerr << " or " << endl;
53  cerr << argv[0] << "../examples/data/cloud.00000.vtk /tmp/output.csv" << endl << endl;
54 
55 }
56 
57 int main(int argc, char *argv[])
58 {
59  if (argc < 3)
60  {
61  usage(argv);
62  return 1;
63  }
64 
65  setLogger(PM::get().LoggerRegistrar.create("FileLogger"));
66 
67  DP d(DP::load(argv[argc-2]));
68 
69  if (argc == 4)
70  {
71  ifstream ifs(argv[1]);
72  if (!ifs.good())
73  {
74  cerr << "Cannot open config file " << argv[1] << endl;
75  usage(argv);
76  return 2;
77  }
78  PM::DataPointsFilters f(ifs);
79  f.apply(d);
80 
81  }
82 
83  d.save(argv[argc-1]);
84 
85  return 0;
86 }
main
int main(int argc, char *argv[])
Definition: convert.cpp:57
kitti-run-seq.f
string f
Definition: kitti-run-seq.py:12
PointMatcher< float >
PointMatcherSupport::setLogger
void setLogger(std::shared_ptr< Logger > newLogger)
Set a new logger, protected by a mutex.
Definition: Logger.cpp:98
usage
void usage(char *argv[])
Definition: convert.cpp:47
PointMatcher::DataPoints
A point cloud.
Definition: PointMatcher.h:207
PM
PointMatcher< float > PM
Definition: convert.cpp:44
d
d
std
PointMatcher< float >::get
static const PointMatcher & get()
Return instances.
Definition: Registry.cpp:141
PointMatcherSupport
Functions and classes that are not dependant on scalar type are defined in this namespace.
Definition: Bibliography.cpp:45
DP
PM::DataPoints DP
Definition: convert.cpp:45
PointMatcher::DataPoints::load
static DataPoints load(const std::string &fileName)
Load a point cloud from a file, determine format from extension.
Definition: pointmatcher/IO.cpp:375
PointMatcher.h
public interface


mp2p_icp
Author(s):
autogenerated on Thu Dec 26 2024 03:48:10