How to convert GpuMat to CvMat in OpenCV?

I know how to do the opposite, that is, get GpuMatfrom CvMatvia download, but I need CvMatfrom GpuMat, is there any method that can be used to do this?

+5
source share
2 answers

Explicit Conversion: Mat -> GPUMat

Mat myMat;
GpuMat myGpuMat;
myGpuMat.upload(myMat); //Via a member function
//Or
GpuMat myGpuMat(myMat) //Via a constructor
//Use myGpuMat here...

implicit conversion: GpuMat -> Mat

GpuMat myGpuMat;
Mat myMat = myGpyMat;
//Use myMat here...

Hope this helps, Julien,

+18
source

In win 7, 64 bit, openCV 2.4

GpuMatโ†’ Mat:

cv::gpu::GpuMat dst;
cv::Mat tran(dst);

As you see, dstthere is GpuMat, and tran- Mat.

+1
source

All Articles