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 }
FusionStage
Definition: FusionStage.hpp:66
kfusion::LVRPipeline::calcTimeStats
double calcTimeStats()
Definition: LVRPipeline.cpp:90
kfusion::Options::optimizePlanes
bool optimizePlanes() const
Returns true if cluster optimization is enabled.
Definition: ext/kintinuous/kfusion/src/app/Options.cpp:138
kfusion::TSDFSlice
Definition: types.hpp:37
HMesh
HalfEdgeKinFuMesh< cVertex, lvr::Normal< float > > HMesh
Definition: FusionStage.hpp:62
kfusion::LVRPipeline::pl_
LinearPipeline< pair< TSDFSlice, bool >, MeshPtr > pl_
Definition: LVRPipeline.hpp:53
LVRPipeline.hpp
kfusion::LVRPipeline::resetMesh
void resetMesh()
Definition: LVRPipeline.cpp:77
kfusion::LVRPipeline::slice_count_
size_t slice_count_
Definition: LVRPipeline.hpp:51
kfusion
Utility.
Definition: capture.hpp:8
kfusion::Options::verbose
bool verbose() const
Definition: ext/kintinuous/kfusion/src/app/Options.cpp:160
kfusion::KinFuParams::distance_camera_target
double distance_camera_target
Definition: types.hpp:142
kfusion::LVRPipeline::meshPtr_
MeshPtr meshPtr_
Definition: LVRPipeline.hpp:50
kfusion::KinFuParams
Definition: types.hpp:127
kfusion::KinFuParams::volume_size
Vec3f volume_size
Definition: types.hpp:138
kfusion::KinFuParams::volume_dims
Vec3i volume_dims
Definition: types.hpp:137
kfusion::KinFuParams::cmd_options
Options * cmd_options
Definition: types.hpp:162
OptimizeStage
Definition: OptimizeStage.hpp:63
kfusion::LVRPipeline::~LVRPipeline
~LVRPipeline()
Definition: LVRPipeline.cpp:71
MeshStage
Definition: MeshStage.hpp:73
kfusion::LVRPipeline::timeStats_
std::vector< double > timeStats_
Definition: LVRPipeline.hpp:52
kfusion::LVRPipeline::addTSDFSlice
void addTSDFSlice(TSDFSlice slice, const bool last_shift)
Definition: LVRPipeline.cpp:82
GridStage
Definition: GridStage.hpp:70


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 Wed Mar 2 2022 00:37:24