这是我正在使用的代码:
cv::Mat mask, foreground;
std::thread t(cv::threshold, mask, foreground, 254, 255, cv::THRESH_BINARY);
t.join();
使用Xcode 8进行编译,支持C 11.任何想法?
这是完整的错误消息:
在/Users/mlitvin/xcode/Create/ImageProcUtils.cpp:13中包含的文件中:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c / v1 / thread:347:5:错误:尝试使用已删除的函数__invoke(VSTD :: move(VSTD :: get( t)),_ VSTD :: move(VSTD :: get(_ t))...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c / v1 / thread:357:5:注意:在实例化函数模板特化'std :: __ 1 :: __ thread_execute'在这里请求__thread_execute(* __ p,Index()); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c / v1 / thread:369:42:注意:在实例化函数模板特化'std :: __ 1 :: __ thread_proxy>'在这里请求int ec = pthread_create(& t,0,&__ thread_proxy,__ p.get()); ^ /Users/mlitvin/xcode/Create/ImageProcUtils.cpp:71:21:注意:在实例化函数模板特化'std :: __ 1 :: thread :: thread'这里请求std :: thread t(cv :: threshold ,mask,foreground,254,255,cv :: THRESH_BINARY); ^在包含的文件中:368:包含在文件中的文件:3:在/Users/mlitvin/xcode/Create/Create/Create_Prefix.h:25中包含的文件:包含在/ Users / mlitvin / xcode / Create / 3rdParty中的文件/OpenCV-2.3.1/modules/imgproc/include/opencv2/imgproc/imgproc.hpp:50:/Users/mlitvin/xcode/Create/3rdParty/OpenCV-2.3.1/modules/core/include/中包含的文件opencv2 / core / core.hpp:56:包含在/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c / v1 / algorithm:625中的文件:/ Applications /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c / v1 / type_traits:1087:5:注意:'~__nat'已在此明确标记删除~__nat() =删除;生成^ 1错误 .
Edit 1:
看起来问题是将 cv::OutputArray
类型的对象作为参数传递 .
1 回答
我设法通过添加代理函数来解决这个问题,其中只有输出通过引用传递:
我很高兴知道为什么原始方法不起作用 - 会接受一个解释的答案 .