Optimized Belief Propagation (CPU and GPU)
DisparityMapEvaluation.cpp
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 #include "DisparityMapEvaluation.h"
28 
29 //initialize evaluation results with evaluation parameters
32 {
33  disparity_error_max_ = eval_params.max_diff_cap;
34  for (const auto& output_diff_threshold :
35  eval_params.output_diff_thresholds)
36  {
37  num_sig_diff_pixels_at_thresholds_[output_diff_threshold] = 0;
38  }
39 }
40 
41 //retrieve evaluation results as RunData for output
43 {
44  RunData evalRunData;
45  evalRunData.AddDataWHeader(
46  std::string(beliefprop::kAvgRMSErrorHeader),
48  evalRunData.AddDataWHeader(
49  std::string(beliefprop::kAvgRMSErrorHeader) +
50  " (with disparity error cap at " +
51  std::to_string(disparity_error_max_) + ")",
53  for (const auto& [threshold, prop_bad_pixels] :
55  {
56  evalRunData.AddDataWHeader(
57  "Proportion bad pixels (error less than " +
58  std::to_string(threshold) + ")",
59  (double)prop_bad_pixels);
60  }
61 
62  return evalRunData;
63 }
Declares class to store disparity map evaluation results.
std::array< float, 2 > average_disp_abs_diff_no_max_w_max_
Total and average value of the absolute difference between the disparity values for all pixels in dis...
std::map< float, unsigned int > num_sig_diff_pixels_at_thresholds_
Stores the number of pixels where the difference between the disparity values in disparity images 1 a...
void InitializeWithEvalParams(const beliefprop::DisparityMapEvaluationParams &eval_params)
Initialize evaluation results with evaluation parameters.
RunData AsRunData() const
Retrieve evaluation results as RunData.
std::map< float, float > prop_sig_diff_pixels_at_thresholds_
Proportion of pixels where the difference between the disparity values in disparity images 1 and 2 is...
Class to store headers with data corresponding to current program run and evaluation.
Definition: RunData.h:42
void AddDataWHeader(const std::string &header, const std::string &data)
Add string data with header describing added data.
Definition: RunData.cpp:49
bp_single_thread_imp::image< uchar > * threshold(bp_single_thread_imp::image< T > *src, int t)
Definition: imutil.h:51
constexpr std::string_view kAvgRMSErrorHeader
Constant string view for header of average RMS error in evaluation.
Struct to store parameters for evaluation of disparity map from stereo processing.
const std::vector< float > output_diff_thresholds
Difference thresholds for comparing disparity maps.