Optimized Belief Propagation (CPU and GPU)
BpFileHandling.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2024 Scott Grauer-Gray
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
27 #ifndef BPFILEHANDLING_H_
28 #define BPFILEHANDLING_H_
29 
30 #include <filesystem>
31 #include <algorithm>
32 #include "BpFileHandlingConsts.h"
33 
39 public:
46  explicit BpFileHandling(const std::string& stereo_set_name) :
47  stereo_set_path_{StereoSetsPath() / stereo_set_name}, num_out_disp_map_{1} { }
48 
55  std::filesystem::path RefImagePath() const;
56 
63  std::filesystem::path TestImagePath() const;
64 
71  const std::filesystem::path GetCurrentOutputDisparityFilePathAndIncrement() {
72  return stereo_set_path_ /
73  (std::string(beliefprop::kOutDispImageNameBase) + std::to_string(num_out_disp_map_++) + ".pgm");
74  }
75 
81  const std::filesystem::path GroundTruthDisparityFilePath() const {
82  return stereo_set_path_ / (std::string(beliefprop::kGroundTruthDispFile));
83  }
84 
85 private:
92  std::filesystem::path StereoSetsPath() const;
93 
94  const std::filesystem::path stereo_set_path_;
95  unsigned int num_out_disp_map_;
96 };
97 
98 #endif /* BPFILEHANDLING_H_ */
Belief propagation implementation constants related to file processing.
Class to retrieve path of stereo set files for reading and for output.
std::filesystem::path RefImagePath() const
Return path to reference image with valid extension if found, otherwise throw filesystem error.
BpFileHandling(const std::string &stereo_set_name)
Constructor takes stereo set name as input, which must match the directory name of the stereo set.
const std::filesystem::path GroundTruthDisparityFilePath() const
Get file path to ground truth disparity map.
const std::filesystem::path GetCurrentOutputDisparityFilePathAndIncrement()
Return path to use for current output disparity and then increment (to support multiple computed outp...
std::filesystem::path TestImagePath() const
Return path to test image with valid extension if found, otherwise throw filesystem error.
constexpr std::string_view kGroundTruthDispFile
constexpr std::string_view kOutDispImageNameBase