Error with boost::thread and GoodFeaturesToTrackDetector_GPU
Hey,
I am using OpenCV(C++) 2.4.8 with the GPU and boost::thread. When I am executing the Code in the appendix I get an error message(Gleitkomma-Ausnahme or Speicherzugriffsfehler). Know someone, if this is an error in my code or if the Opencv gpu functions are not thread-able?
Regards Christoph
Output in Terminal:
Start
Test
Speicherzugriffsfehler
//Code:
void foo(cv::gpu::GpuMat& greyFrame, int maxPoints = 1000, float qualityLevel = 0.05)
{
gpu::GpuMat corners;
int minDistance = 5;
gpu::GoodFeaturesToTrackDetector_GPU gFtTD(maxPoints, qualityLevel, minDistance);
gFtTD(greyFrame, corners);
}
void testFnc(cv::gpu::GpuMat* greyFrame)
{
foo(*greyFrame);
}
int main(int argc, char *argv[])
{
std::vector<cv::mat> e;
std::vector<cv::gpu::gpumat> g;
int i;
std::cout << "Start" << std::endl;
e.push_back(imread("/eda/media/video-motion/tor/00001.png"));
g.push_back(cv::gpu::GpuMat(e.back()));
e.push_back(imread("/eda/media/video-motion/tor/00001.png"));
g.push_back(cv::gpu::GpuMat(e.back()));
thread_g.create_thread(bind(testFnc, &g.at(0)));
thread_g.create_thread(bind(testFnc, &g.back()));
thread_g.join_all();
std::cout << "Test" << std::endl;
for(i = 0; i < 4; i++)
{
e.push_back(imread("/eda/media/video-motion/tor/00001.png"));
g.push_back(cv::gpu::GpuMat(e.back()));
thread_g.create_thread(bind(testFnc, &g.back()));
}
thread_g.join_all();
std::cout << "End" << std::endl;
// ...
return 0;
}