Dániel Terbe
Dániel Terbe

Reputation: 105

No matching function for cv::merge

I want to merge 3 monochrome camera image in one 3 channeled opencv matrix. I try this in the following way:

    cv::Mat merged;
    std::vector<cv::Mat> channels[3];

    while(1){
        channels[0]=Camera1->getNextFrameSWTrig();  //give back frame_time and frame_num
        channels[1]=Camera2->getNextFrameSWTrig();  //give back frame_time and frame_num
        channels[2]=Camera3->getNextFrameSWTrig();

        cv::merge(channels, merged);

        (*buffer).push_back(merged.clone());

    }

But the following error message comes:

no matching function for call to 'merge'

Altough in the OpenCV documentation I found:

C++: void merge(InputArrayOfArrays mv, OutputArray dst)

Upvotes: 1

Views: 1238

Answers (1)

Miki
Miki

Reputation: 41765

With

std::vector<cv::Mat> channels[3];
                             ^ ^

you're creating an array of 3 std::vector, while you want a std::vector with 3 elements:

std::vector<cv::Mat> channels(3);
                             ^ ^

Upvotes: 3

Related Questions