Rahibe Meryem
Rahibe Meryem

Reputation: 269

C++ thread async for cv::Mat returning vector<rectangle>

I want to send captured frames to the different async thread in c++ , so my 6 frames can simultaneously process in threads and send back a vector

I couldnt succeed (I am scala guy new to c++)

here the func and the main :

std::vector<rectangle> frame_Face_Detection(cv::Mat& value)
{
    std::vector<rectangle> facesX;
    //do stuff
    return facesX;

}

in main:

std::future<std::vector<rectangle>> fn = 
  async(std::launch::async, frame_Face_Detection , &im_small);

it says :

async (not matching function) error...

any help for a beginer ?

Upvotes: 2

Views: 1090

Answers (1)

rafix07
rafix07

Reputation: 20934

You have to use std::ref to pass object by reference to your function

cv::Mat im_small;
async(std::launch::async, frame_Face_Detection , std::ref(im_small));

Upvotes: 1

Related Questions