mardi 4 juillet 2017

no matching function for call to ‘std::thread::thread(

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);
}
}

the above function is being called -threaded- by this function:

void startCAM()
{

    if(show_left){
     cam_call = std::thread(show_image);
    }
    //Wait for data to be grabbed
    while(!has_data)
      sleep_ms(1);
}

and I get the error:

     error: no matching function for call to ‘std::thread::thread(<unresolved     overloaded function type>)’
      cam_call = std::thread(show_image);

It should be noted I use no classes or objects, so show_image is not a member function

Aucun commentaire:

Enregistrer un commentaire