First thing: I read related questions & solutions didn't fix the error.
considering:
double foo(cv::InputArray Input1,
cv::InputArray Input2,
cv::InputOutputArray InOut,
cv::TermCriteria criteria=cv::TermCriteria(cv::TermCriteria::MAX_ITER+cv::TermCriteria::EPS, 50, 0.001)),
cv::InputArray Input3 = cv::noArray())
{
return 2;
}
If I call the function with:
cv::Mat In1, In2, InOut; //dummy for test
double ret = foo(In1, In2, InOut);
it compiles; but when I try to thread it I got this error:
no type named "type" in class std::result
double ret = 0;
std::thread th(ret, &foo, &In1, &In2, InOut);
So I tried with std::ref, but it gives me the same error:
double ret = 0;
std::thread th(ret, &foo, std::ref(In1), std::ref(In2), std::ref(InOut));
First point:
To get your output you'll need to use other tools (check the linked answer), or the simplest will be to use a double& as parameter.
Second point:
You don't need std::ref() on the cv::Mat, but will need if for the double&, you just need to define your default values in the std::thread constructor.
this should compile (not tested, but In confident in the result):
std::thread t(&foo, In1, In2, InOut, cv::TermCriteria(values), cv::noArray(), std::ref(retval));
with:
void foo(cv::InputArray Input1,
cv::InputArray Input2,
cv::InputOutputArray InOut,
cv::TermCriteria criteria=cv::TermCriteria(cv::TermCriteria::MAX_ITER+cv::TermCriteria::EPS, 50, 0.001)),
cv::InputArray Input3 = cv::noArray(),
double& retval)
{
retval = 2;
}