Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

cv::merge execution time on CV_32S

$
0
0
Hello, I used following code snippet to merge a few single channel images into a multichannel Mat: vector 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); On my machine this code execution time is about 500 ms (!!!), regardless of number of elements in `vector images` (i.e. even if numcomps == 1). What can be the reasons behind such an overhead? If I rewrite code as follows it reduces execution time to 2 ms: cv::Mat result(h, w, CV_MAKETYPE(CV_32S, numcomps)); vector images(numcomps); for (int i = 0; i < numcomps; i++) { int from_to[] = { 0,i }; images[i] = cv::Mat(h, w, CV_32SC1, (image->comps + comps[i])->data); cv::mixChannels(&images[i], 1, &result, 1, from_to, 1); } imageMat = result; I'm using OpenCV 3.1.0 built with CUDA 7.5 (Ubuntu 14.04, Intel® Core™ i3-4170 CPU @ 3.70GHz × 4, GeForce GTX 960/PCIe/SSE2 ). Cheers, Kate

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>