Ask Your Question
0

Convert from GpuMat to Mat

asked 2016-01-18 08:37:46 -0600

Graver gravatar image

I have a little piece of code that try to convert a Mat to GpuMat and reverse. When I try to upload the Mat in GpuMat with "upload" function, it breaks. If I go next step in the debug the size of GpuMat is written, same as Mat but it doesn't upload the pixel data. Here is the code:

Mat initFrame;
Mat initconv;
Mat threshold;
imageCircle.copyTo(initFrame);
cvtColor(initFrame,initconv,CV_BGR2HSV);

gpu::GpuMat myFrame;
gpu::GpuMat myFrameLab;

myFrame.upload(initconv);

myFrame.download(threshold);
//gpu::cvtColor(myFrame,myFrameLab,CV_BGR2YCrCb);
imshow("INPUT",threshold);

I read that I will need Opencv built with GPU support. Here I don't know what to do. I saw somewhere that in OpenCV directories it exist /gpu/built/... I have 2.4.9 and 3.1 versions but I don't find in Opencv directory the /gpu/build/...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-20 08:24:19 -0600

It means that you need to build OpenCV library completely from scratch with GPU support. This guide which comes along with the OpenCV 3 Blueprints book explains it in detail on how to do so.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-01-18 08:37:46 -0600

Seen: 3,024 times

Last updated: Jan 20 '16