Trying to use Threads on the Jetson TK1

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
	cv::VideoCapture Cap;
	std::thread detections[N];
        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:
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?

I don’t think it looks like there is enough information here for anyone to give any real answer. There is so very much which can cause threading issues that the above code doesn’t really show enough to help. If your question truly is more of a threading question there may be other forums with more people to respond; the V4L part is more likely to get a response here versus the threading part, but this too probably needs more information.

FYI, for the above code, you may want to edit (the “pencil” icon on upper right of the comment when your mouse is over the comment), highlight the code part, and use the code block tag (the “</>” icon, right side of the edit tool bar) to turn it into more readable code.