I am trying to compile a opencv program and I am getting the error
invalid initialization of reference of type ‘cv::InputArray {aka const cv::_InputArray&}’ from expression of type ‘std::vector<double, std::allocator<double> >::const_iterator
(strangely I only get this error when building it in my Jetson Xavier. When I build it in my PC no problem arises)
The problematic code is
unordered_map<string, vector> timers;
for (auto const& timer : timers)
{
cout << "- " << timer.first << " : " << accumulate(timer.second.begin(), timer.second.end(), 0.0) << " seconds"<< endl;
}
The problem is in timer.second.begin()
. I think timer.second
is a vector<doubles>
. I don't understand where this cv::InputArray
comes.
Edit
The MRE is
#include <iostream>
#include <unordered_map>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/video.hpp>
#include <opencv2/cudaarithm.hpp>
#include <opencv2/cudaimgproc.hpp>
#include <opencv2/cudawarping.hpp>
#include <opencv2/cudaoptflow.hpp>
using namespace cv;
using namespace cv::cuda;
using namespace std;
int main( int argc, const char** argv )
{
unordered_map<string, vector<double>> timers;
timers["one"].push_back(10001.00);
timers["two"].push_back(20002.00);
timers["three"].push_back(30003.00);
for (auto const& timer : timers)
{
cout << "- " << timer.first << " : " << accumulate(timer.second.begin(), timer.second.end(), 0.0) << " seconds"<< endl;
}
}