Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thanks @matman for an answer!

The overhead was caused by OpenCL initialization. I added #include<opencv2 core="" ocl.hpp=""> and switched off OpenCL usage before calling merge(InputArrayOfArrays _mv, OutputArray _dst) . Now it works as I originally expected.

cv::ocl::setUseOpenCL(false) vector<cv::mat> images(numcomps); for (int i = 0; i < numcomps; i++) images[i] = cv::Mat(h, w, CV_32SC1, (image->comps + comps[i])->data); cv::merge(images, imageMat);

Thanks @matman for an answer!

The overhead was caused by OpenCL initialization. I added #include<opencv2 core="" ocl.hpp=""> #include<opencv2/core/ocl.hpp> and switched off OpenCL usage before calling merge(InputArrayOfArrays _mv, OutputArray _dst) _dst) . Now it works as I originally expected.

cv::ocl::setUseOpenCL(false)
vector<cv::mat> vector<cv::Mat> images(numcomps);
for (int i = 0; i < numcomps; i++)
    images[i] = cv::Mat(h, w, CV_32SC1, (image->comps + comps[i])->data);
cv::merge(images, imageMat);

imageMat);

Thanks @matman for an answer!

The overhead was caused by OpenCL code initialization. I added #include<opencv2/core/ocl.hpp> and switched off OpenCL usage before calling merge(InputArrayOfArrays _mv, OutputArray _dst) . Now it works as I expected.

cv::ocl::setUseOpenCL(false)
vector<cv::Mat> images(numcomps);
for (int i = 0; i < numcomps; i++)
    images[i] = cv::Mat(h, w, CV_32SC1, (image->comps + comps[i])->data);
cv::merge(images, imageMat);