I am trying to fill a struct with Mat objects to pass to a thread.
struct thread_data{
int thread_id;
int socket;
uchar* receiveBuffer;
// MAT IMAGE HEADERS:
Mat _leftImage;
Mat _rightImage;
Mat _leftDepth;
Mat _rightDepth;
vector _results;
};
Then I create an array of structs like this:
struct thread_data td[MAX_THREADS];
Following, each struct gets populated, where the Mats in the struct are filled with Mats saved in Vectors :
for(i = 0; i < numThreads ; i++){
td[i].thread_id = i;
td[i].socket = connected;
td[i].receiveBuffer = threadRecBuffer[i];
td[i]._leftImage = leftImages[i];
td[i]._rightImage = rightImages[i];
td[i]._leftDepth = leftDepth[i];
td[i]._rightDepth = rightDepth[i];
td[i]._results = resultsVector;
}
I get a segmentation fault 11 as soon as the first Mat is trying to get assigned.
Has anyone got any experience with passing Mats in structs ?
Thanks in advance.
↧