Verwenden von STD :: Async mit einer Methode, die ein cv :: outputArray empfängt, um sie zuzuweisen, funktioniert nicht
Posted: 14 Feb 2025, 04:36
Ich habe die folgende Funktion: < /p>
Es funktioniert einwandfrei und andere Func erhält Ergebnis durch myfunc .
, aber wenn ich STD verwende :: async wie folgt: empfängt leeres Ergebnis . Was mache ich falsch?
Code: Select all
void MyClass::myFunc(cv::OutputArray dst) const {
cv::Mat result;
...
dst.assign(result);
}
< /code>
Wenn ich es so ausführecv::Mat result;
myFunc(result);
otherFunc(result);
, aber wenn ich STD verwende :: async wie folgt:
Code: Select all
cv::Mat result;
auto resultFuture = std::async(&MyClass::myFunc, this, result);
resultFuture.wait();
otherFunc(result);
< /code>
otherFunc