Ask Your Question

stitching 2 images together in CUDA like hconcat?

asked 2014-11-03 11:31:46 -0500

Echo88 gravatar image

Is there a function or workaround-method to horizontally concatenate 2 images together directly in CUDA? My program grabs 2 frames by highspeed-cameras, uploads them to CUDA, processes them and downloads them, then the images are concatenated by hconcat on the cpu (which i need to avoid as it drastically reduces my framerate) and displayed via OpenGL.

Surely its possible to stitch the images together via OpenGL, but i would rather like to do it via CUDA. I use OpenCV 3.0 and CUDA 6.5.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-02 11:53:02 -0500

dtmoodie gravatar image

You can allocate a matrix of the correct size and then copy the images into the new matrix manually with the following:

cv::cuda::GpuMat NewImg(img1.rows, img1.cols + img2.cols, img1.type); img1.copyTo(NewImg(cv::Rect(0,0,img1.cols,img1.rows))); img2.copyTo(NewImg(cv::Rect(img1.cols,img1.rows, img2.cols,img2.rows)));

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-11-03 11:31:46 -0500

Seen: 950 times

Last updated: Nov 03 '14