benchmark.hpp
940 Bytes
#pragma once
#include <iostream>
#include <memory>
#include <opencv2/core.hpp>
#include "data/hdf5/CVMatLoader.hpp"
#include "data/provider/H5FrameProvider.hpp"
namespace Benchmark {
std::unique_ptr<H5FrameProvider>
createFrameProvider(const std::string &filePath = "20171114.053_AEF20.h5") {
const auto timestamps =
CVMatLoader(ResourceLocator::getPathProvider().path(filePath))
.asVec<unsigned long>("/timestamps", H5SingleDataReader::UINT64);
return std::make_unique<H5FrameProvider>(
ResourceLocator::getPathProvider().path(filePath), "/images",
timestamps);
}
void displayStats(const std::vector<double> &timings) {
cv::Scalar mean, std;
cv::meanStdDev(timings, mean, std);
double min{-1}, max{-1};
cv::minMaxIdx(timings, &min, &max, nullptr, nullptr);
std::cout << "Mean: " << mean[0] << " Std Dev.: " << std[0]
<< " Min: " << min << " Max: " << max << '\n';
}
} // namespace Benchmark