FusionStage.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  * FusionStage.cpp
34  *
35  * @date 13.11.2015
36  * @author Tristan Igelbrink (Tristan@Igelbrink.com)
37  */
38 
39 #include <kfusion/FusionStage.hpp>
40 
41 // default constructor
43  , mesh_(mesh), mesh_count_(0), options_(options)
44 {
45 
46 }
47 
48 void FusionStage::firstStep() { /* skip */ };
49 
51 {
52  auto mesh_work = boost::any_cast<pair<pair<MeshPtr, bool>, vector<kfusion::ImgPose*> > >(getInQueue()->Take());
53  bool last_shift = mesh_work.first.second;
54  MeshPtr opti_mesh = mesh_work.first.first;
55  string mesh_notice = ("#### D: Mesh Fusion " + to_string(mesh_count_) + " ####");
56  ScopeTime* fusion_time = new ScopeTime(mesh_notice.c_str());
57  if(mesh_count_ == 0)
58  mesh_ = opti_mesh;
59  else
60  mesh_->addMesh(opti_mesh, options_->textures());
61  //mesh_->fillHoles(options_->getFillHoles());
62  //optiMesh_->restorePlanes(options_->getMinPlaneSize());
63  getOutQueue()->Add(mesh_);
64  mesh_count_++;
65  delete fusion_time;
66  if(last_shift)
67  done(true);
68 }
70 {
71  std::cout << "Global amount of vertices: " << mesh_->meshSize() << endl;
72  std::cout << "Global amount of faces: " << mesh_->getFaces().size() << endl;
73  mesh_->finalize();
74  ModelPtr m( new Model( mesh_->meshBuffer() ) );
75  if(!options_->textures())
76  ModelFactory::saveModel( m, string(options_->getOutput() + ".ply"));
77  else
78  ModelFactory::saveModel( m, string(options_->getOutput() + ".obj"));
79  std::cout << "Finished saving" << std::endl;
80 }
FusionStage::FusionStage
FusionStage(MeshPtr mesh, Options *options)
Definition: FusionStage.cpp:42
FusionStage::options_
Options * options_
Definition: FusionStage.hpp:79
kfusion::ScopeTime
Definition: types.hpp:103
AbstractStage::done
bool done() const
Definition: AbstractStage.hpp:91
kfusion::Options::textures
bool textures() const
Definition: ext/kintinuous/kfusion/src/app/Options.cpp:143
FusionStage::mesh_
MeshPtr mesh_
Definition: FusionStage.hpp:81
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
FusionStage::mesh_count_
size_t mesh_count_
Definition: FusionStage.hpp:80
AbstractStage
Definition: AbstractStage.hpp:49
FusionStage::firstStep
virtual void firstStep()
Definition: FusionStage.cpp:48
FusionStage::step
virtual void step()
Definition: FusionStage.cpp:50
FusionStage.hpp
MeshPtr
HMesh * MeshPtr
Definition: FusionStage.hpp:63
lvr2::ModelPtr
std::shared_ptr< Model > ModelPtr
Definition: Model.hpp:80
kfusion::Options
A class to parse the program options for the reconstruction executable.
Definition: ext/kintinuous/kfusion/include/kfusion/Options.hpp:51
AbstractStage::getOutQueue
boost::shared_ptr< BlockingQueue > getOutQueue() const
Definition: AbstractStage.hpp:89
AbstractStage::getInQueue
boost::shared_ptr< BlockingQueue > getInQueue() const
Definition: AbstractStage.hpp:88
FusionStage::lastStep
virtual void lastStep()
Definition: FusionStage.cpp:69
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
kfusion::Options::getOutput
string getOutput() const
Definition: ext/kintinuous/kfusion/src/app/Options.cpp:90


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:23