LVRPipeline.cpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following
12  * disclaimer in the documentation and/or other materials provided
13  * with the distribution.
14  * * Neither the name of Willow Garage, Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 /*
33  * LVRPipeline.cpp
34  *
35  * @date 13.11.2015
36  * @author Tristan Igelbrink (Tristan@Igelbrink.com)
37  */
38 
39 #include <kfusion/LVRPipeline.hpp>
40 
41 using namespace lvr;
42 
43 namespace kfusion
44 {
45  LVRPipeline::LVRPipeline(KinFuParams params) : slice_count_(0)
46  {
47  meshPtr_ = new HMesh();
48  meshPtr_->setQuiet(!params.cmd_options->verbose());
49  omp_set_num_threads(omp_get_num_procs());
50 
51  // Adding the single processing stages to the pipeline
52  pl_.AddStage(
53  boost::shared_ptr<GridStage>(new GridStage((double)(params.volume_size[0] / params.volume_dims[0]), params.cmd_options))
54  );
55  pl_.AddStage(
56  boost::shared_ptr<MeshStage>(new MeshStage(params.distance_camera_target, (double)(params.volume_size[0] / params.volume_dims[0]), params.cmd_options))
57  );
58  if(params.cmd_options->optimizePlanes())
59  {
60  pl_.AddStage(
61  boost::shared_ptr<OptimizeStage>(new OptimizeStage(params.cmd_options))
62  );
63  }
64  pl_.AddStage(
65  boost::shared_ptr<FusionStage>(new FusionStage(meshPtr_, params.cmd_options))
66  );
67 
68  pl_.Start();
69  }
70 
72  {
73  pl_.join();
74  delete meshPtr_;
75  }
76 
78  {
79  //TODO implement mesh reset
80  }
81 
82  void LVRPipeline::addTSDFSlice(TSDFSlice slice, const bool last_shift)
83  {
84 
85  pair<TSDFSlice, bool> workload(slice, last_shift);
86  pl_.AddWork(workload);
87  slice_count_++;
88  }
89 
91  {
92  return std::accumulate(timeStats_.begin(), timeStats_.end(), 0.0) / timeStats_.size();
93  }
94 
95 }
HalfEdgeKinFuMesh< cVertex, lvr::Normal< float > > HMesh
Definition: FusionStage.hpp:62
std::vector< double > timeStats_
Definition: LVRPipeline.hpp:52
double distance_camera_target
Definition: types.hpp:142
void addTSDFSlice(TSDFSlice slice, const bool last_shift)
Definition: LVRPipeline.cpp:82
Options * cmd_options
Definition: types.hpp:162
LinearPipeline< pair< TSDFSlice, bool >, MeshPtr > pl_
Definition: LVRPipeline.hpp:53
Utility.
Definition: capture.hpp:8
bool optimizePlanes() const
Returns true if cluster optimization is enabled.


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:08