Hi everyone,
I’m trying to make a program that can detect multiple items with a video camera.
I created few separate algorithms and I want to run them concurrently on different threads.
(obviously I’m using OpenCV libraries)
this is the function that suppose to initialize the threads:
#include <thread>
Class A
{
private:
cv::VideoCapture Cap;
std::thread detections[N];
public:
template <class T>
void initDetection(T* dtct,IDX i)
{
if (dtct != NULL)
{
if (Cap.isOpened())
{
[b] detections[i] = thread([&] {dtct->Detect(Cap);});
[/b] if (detections[i].joinable())
cout << typeid(*dtct).name() + 6 << " Detection initialized" << endl;
}
}
}
};
This gives me the error:
“HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CORP
Segmentation fault”
however, when calling the function Detect without a thread its working.
even though it shows “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CORP”
I don’t mind the “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CORP” as long as it works (couldn’t get rid of it anyway) but I really need this to work on the threads (trying to work 4 different threads but the error remains even with one)
for now, I want to use the CPU and not use CUDA.
advice anyone?