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不是成员函数
答案 0 :(得分:2)
错误说std::thread::thread(<unresolved overloaded function type>)
,这意味着有多个名为show_image
的函数。
您需要选择其中一个重载。 E.g:
std::thread(static_cast<void(*)()>(show_image));