Point Cloud Library (PCL)  1.9.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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 <string>
40 #include <boost/shared_ptr.hpp>
41 #include <pcl/gpu/containers/kernel_containers.h>
42 #include <pcl/gpu/kinfu_large_scale/kinfu.h>
43 
44 
45 /** \brief class for RGB-D SLAM Dataset and Benchmark
46  * \author Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
47  */
48 class Evaluation
49 {
50 public:
51  typedef boost::shared_ptr<Evaluation> Ptr;
52  typedef /*pcl::gpu::KinfuTracker::PixelRGB*/ pcl::gpu::kinfuLS::PixelRGB RGB;
53 
54  Evaluation(const std::string& folder);
55 
56  /** \brief Sets file with matches between depth and rgb */
57  void setMatchFile(const std::string& file);
58 
59  /** \brief Reads rgb frame from the folder
60  * \param stamp index of frame to read (stamps are not implemented)
61  * \param rgb24
62  */
63  bool grab (double stamp, pcl::gpu::PtrStepSz<const RGB>& rgb24);
64 
65  /** \brief Reads depth frame from the folder
66  * \param stamp index of frame to read (stamps are not implemented)
67  * \param depth
68  */
69  bool grab (double stamp, pcl::gpu::PtrStepSz<const unsigned short>& depth);
70 
71  /** \brief Reads depth & rgb frame from the folder. Before calling this folder please call 'setMatchFile', or an error will be returned otherwise.
72  * \param stamp index of accociated frame pair (stamps are not implemented)
73  * \param depth
74  * \param rgb24
75  */
77 
78  const static float fx, fy, cx, cy;
79 
80 
81  void saveAllPoses(const pcl::gpu::kinfuLS::KinfuTracker& kinfu, int frame_number = -1, const std::string& logfile = "kinfu_poses.txt") const;
82 
83 private:
84  std::string folder_;
85  bool visualization_;
86 
87  std::vector< std::pair<double, std::string> > rgb_stamps_and_filenames_;
88  std::vector< std::pair<double, std::string> > depth_stamps_and_filenames_;
89 
90  struct Association
91  {
92  double time1, time2;
93  std::string name1, name2;
94  };
95 
96  std::vector< Association > accociations_;
97 
98  void readFile(const std::string& file, std::vector< std::pair<double, std::string> >& output);
99 
100  struct Impl;
101  boost::shared_ptr<Impl> impl_;
102 };
103 
void saveAllPoses(const pcl::gpu::KinfuTracker &kinfu, int frame_number=-1, const std::string &logfile="kinfu_poses.txt") const
void setMatchFile(const std::string &file)
Sets file with matches between depth and rgb.
static const float fy
Definition: evaluation.h:78
Input/output pixel format for KinfuTracker.
Definition: pixel_rgb.h:50
static const float cx
Definition: evaluation.h:78
boost::shared_ptr< Evaluation > Ptr
Definition: evaluation.h:51
pcl::gpu::kinfuLS::PixelRGB RGB
Definition: evaluation.h:52
bool grab(double stamp, pcl::gpu::PtrStepSz< const RGB > &rgb24)
Reads rgb frame from the folder.
KinfuTracker class encapsulates implementation of Microsoft Kinect Fusion algorithm.
Definition: kinfu.h:71
class for RGB-D SLAM Dataset and Benchmark
Definition: evaluation.h:48
Evaluation(const std::string &folder)
static const float cy
Definition: evaluation.h:78
static const float fx
Definition: evaluation.h:78