GridStage.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  * GridStage.cpp
34  *
35  * @date 13.11.2015
36  * @author Tristan Igelbrink (Tristan@Igelbrink.com)
37  */
38 
39 #include <kfusion/GridStage.hpp>
40 
41 // default constructor
43 {
44  grid_count_ = 0;
45  voxel_size_ = voxel_size;
46  bbox_ = BoundingBox<cVertex>(0.0, 0.0, 0.0, 300.0, 300.0, 300.0);
47  bbox_.expand(300.0, 300.0, 300.0);
48  timestamp.setQuiet(!options->verbose());
49 }
50 
51 void GridStage::firstStep() { /* omit */ };
52 
54 {
55  auto slice_work = boost::any_cast<pair<TSDFSlice, bool> >(getInQueue()->Take());
56  cv::Mat& tsdf_values = slice_work.first.tsdf_values_;
57  Vec3i offset = slice_work.first.offset_;
58  Vec3i back_offset = slice_work.first.back_offset_;
59  bool last_shift = slice_work.second;
60  Point* tsdf_ptr = tsdf_values.ptr<Point>();
61  TGrid* act_grid = NULL;
62  string grid_notice = ("#### A: Grid Creation " + to_string(grid_count_) + " ####");
63  ScopeTime* grid_time = new ScopeTime(grid_notice.c_str());
64  if(last_grid_queue_.size() == 0)
65  act_grid = new TGrid(voxel_size_, bbox_, tsdf_ptr, tsdf_values.cols, offset[0], offset[1], offset[2], back_offset[0], back_offset[1], back_offset[2], NULL, true);
66  else
67  act_grid = new TGrid(voxel_size_, bbox_, tsdf_ptr, tsdf_values.cols, offset[0], offset[1], offset[2], back_offset[0], back_offset[1], back_offset[2], last_grid_queue_.front(), true);
68 
69  //grid_ptr->saveGrid("./slices/grid" + std::to_string(slice_count_) + ".grid");
70  delete grid_time;
71  if(last_grid_queue_.size() > 0)
72  {
73  delete last_grid_queue_.front();
74  last_grid_queue_.pop();
75  }
76  last_grid_queue_.push(act_grid);
77  getOutQueue()->Add(pair<pair<TGrid*, bool>, vector<ImgPose*> >(pair<TGrid*, bool>(act_grid, last_shift), slice_work.first.imgposes_));
78  grid_count_++;
79  if(last_shift)
80  done(true);
81 }
82 void GridStage::lastStep() { /* omit */ };
TGrid
TsdfGrid< cVertex, cFastBox, kfusion::Point > TGrid
Definition: GridStage.hpp:65
kfusion::ScopeTime
Definition: types.hpp:103
AbstractStage::done
bool done() const
Definition: AbstractStage.hpp:91
GridStage::last_grid_queue_
queue< TGrid * > last_grid_queue_
Definition: GridStage.hpp:85
GridStage::last_shift
bool last_shift
Definition: GridStage.hpp:86
GridStage::firstStep
void firstStep()
Definition: GridStage.cpp:51
NULL
#define NULL
Definition: mydefs.hpp:141
kfusion::Vec3i
cv::Vec3i Vec3i
Definition: types.hpp:17
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
GridStage::step
void step()
Definition: GridStage.cpp:53
AbstractStage
Definition: AbstractStage.hpp:49
GridStage::lastStep
void lastStep()
Definition: GridStage.cpp:82
GridStage::bbox_
BoundingBox< cVertex > bbox_
Definition: GridStage.hpp:83
lvr2::timestamp
static Timestamp timestamp
A global time stamp object for program runtime measurement.
Definition: Timestamp.hpp:116
GridStage::grid_count_
size_t grid_count_
Definition: GridStage.hpp:82
lvr2::Timestamp::setQuiet
void setQuiet(bool quiet)
Definition: Timestamp.hpp:87
GridStage::voxel_size_
double voxel_size_
Definition: GridStage.hpp:84
kfusion::Point
Definition: types.hpp:47
GridStage::GridStage
GridStage(double voxel_size=3.0/512.0, Options *options=NULL)
Definition: GridStage.cpp:42
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
GridStage.hpp


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