Point Cloud Library (PCL)  1.14.1-dev
evaluation.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * Author: Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
35  */
36 
37 #pragma once
38 
39 #include <pcl/gpu/containers/kernel_containers.h>
40 #include <pcl/gpu/kinfu_large_scale/kinfu.h>
41 
42 #include <pcl/memory.h>
43 
44 #include <memory>
45 #include <string>
46 
47 /** \brief class for RGB-D SLAM Dataset and Benchmark
48  * \author Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
49  */
50 class Evaluation
51 {
52 public:
53  using Ptr = pcl::shared_ptr<Evaluation>;
54  using ConstPtr = pcl::shared_ptr<const Evaluation>;
56 
57  Evaluation(const std::string& folder);
58 
59  /** \brief Sets file with matches between depth and rgb */
60  void setMatchFile(const std::string& file);
61 
62  /** \brief Reads rgb frame from the folder
63  * \param stamp index of frame to read (stamps are not implemented)
64  * \param rgb24
65  */
66  bool grab (double stamp, pcl::gpu::PtrStepSz<const RGB>& rgb24);
67 
68  /** \brief Reads depth frame from the folder
69  * \param stamp index of frame to read (stamps are not implemented)
70  * \param depth
71  */
72  bool grab (double stamp, pcl::gpu::PtrStepSz<const unsigned short>& depth);
73 
74  /** \brief Reads depth & rgb frame from the folder. Before calling this folder please call 'setMatchFile', or an error will be returned otherwise.
75  * \param stamp index of associated frame pair (stamps are not implemented)
76  * \param depth
77  * \param rgb24
78  */
80 
81  const static float fx, fy, cx, cy;
82 
83 
84  void saveAllPoses(const pcl::gpu::kinfuLS::KinfuTracker& kinfu, int frame_number = -1, const std::string& logfile = "kinfu_poses.txt") const;
85 
86 private:
87  std::string folder_;
88  bool visualization_;
89 
90  std::vector< std::pair<double, std::string> > rgb_stamps_and_filenames_;
91  std::vector< std::pair<double, std::string> > depth_stamps_and_filenames_;
92 
93  struct Association
94  {
95  double time1, time2;
96  std::string name1, name2;
97  };
98 
99  std::vector< Association > accociations_;
100 
101  void readFile(const std::string& file, std::vector< std::pair<double, std::string> >& output);
102 
103  struct Impl;
104  std::shared_ptr<Impl> impl_;
105 };
106 
class for RGB-D SLAM Dataset and Benchmark
Definition: evaluation.h:51
static const float cy
Definition: evaluation.h:81
bool grab(double stamp, pcl::gpu::PtrStepSz< const RGB > &rgb24)
Reads rgb frame from the folder
pcl::shared_ptr< Evaluation > Ptr
Definition: evaluation.h:53
static const float fx
Definition: evaluation.h:81
bool grab(double stamp, pcl::gpu::PtrStepSz< const unsigned short > &depth)
Reads depth frame from the folder.
static const float cx
Definition: evaluation.h:81
bool grab(double stamp, pcl::gpu::PtrStepSz< const unsigned short > &depth, pcl::gpu::PtrStepSz< const RGB > &rgb24)
Reads depth & rgb frame from the folder.
void setMatchFile(const std::string &file)
Sets file with matches between depth and rgb.
pcl::shared_ptr< const Evaluation > ConstPtr
Definition: evaluation.h:54
static const float fy
Definition: evaluation.h:81
void saveAllPoses(const pcl::gpu::kinfuLS::KinfuTracker &kinfu, int frame_number=-1, const std::string &logfile="kinfu_poses.txt") const
Evaluation(const std::string &folder)
KinfuTracker class encapsulates implementation of Microsoft Kinect Fusion algorithm.
Definition: kinfu.h:72
Defines functions, macros and traits for allocating and using memory.
Input/output pixel format for KinfuTracker.
Definition: pixel_rgb.h:47
Input/output pixel format for KinfuTracker.
Definition: pixel_rgb.h:51