2

I am just trying to process multiple images using tbb in OpenCV as found in this question.

The following is my sample code.

#include <opencv2/opencv.hpp>
#include "tbb/tbb.h"
using namespace tbb;

using namespace cv;
using namespace std;


void processBinary(Mat image) {
    //image processing
    Mat gray;
    cvtColor(image, gray, CV_BGR2GRAY);
}

int main( )
{
    Mat m1, m2, m3, m4;
    m1 = imread("test1.jpg", IMREAD_COLOR); // Read the file
    m2 = imread("test2.jpg", IMREAD_COLOR); // Read the file
    m3 = imread("test3.jpg", IMREAD_COLOR); // Read the file
    m4 = imread("test4.jpg", IMREAD_COLOR); // Read the file
    std::vector<cv::Mat> input = { m1, m2, m3, m4 };
   tbb::parallel_for(size_t(0), input.size(), size_t(1), [=](size_t i) {
    processBinary(input[i]);
});
    return 0;
} 

I ran the file using the command - g++ test1.cpp -a app `pkg-config --cflags --libs opencv

I got the following errors:

/usr/bin/ld: /tmp/cc79ceOq.o: undefined reference to symbol '_ZN3tbb18task_group_contextD1Ev'
//usr/lib/x86_64-linux-gnu/libtbb.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Any help is appreciated !!

yatish h r
  • 363
  • 2
  • 12

0 Answers0