void show_image(){
// Create a Mat to store images
Mat cam_image;
ERROR_CODE err;
// Loop until 'e' is pressed
char key = '';
while (key != 'e') {
// Grab images
err = cam.grab();
// Check if successful
if (err == SUCCESS) {
// Retrieve left image and show with OpenCV
cam.retrieveImage(zed_image, VIEW_LEFT);
cv::imshow("VIEW", cv::Mat(cam_image.getHeight(), cam_image.getWidth(), CV_8UC4, cam_image.getPtr<sl::uchar1>(sl::MEM_CPU)));
key = cv::waitKey(5);
} else
key = cv::waitKey(5);
}
}
上面的函数被这个函数调用-threaded-:
void startCAM()
{
if(show_left){
cam_call = std::thread(show_image);
}
//Wait for data to be grabbed
while(!has_data)
sleep_ms(1);
}
我得到了错误:
error: no matching function for call to ‘std::thread::thread(<unresolved overloaded function type>)’
cam_call = std::thread(show_image);
应该注意我没有使用类或对象,所以 show_image 不是成员函数
最佳答案
错误显示 std::thread::thread(<unresolved overloaded function type>)
, 这意味着有多个名为 show_image
的函数.
您需要选择其中一个重载。例如:
std::thread(static_cast<void(*)()>(show_image));
关于multithreading - 没有匹配函数调用 ‘std::thread::thread(<unresolved overloaded function type>)’,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44908313/