How to convert GpuMat to CvMat in OpenCV?

[亡魂溺海] 提交于 2020-01-01 09:38:46

问题


I know how to do the opposite i.e. get GpuMat from CvMat using upload, but I need a CvMat from GpuMat, is there any method that can be used for this?


回答1:


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 it helped, Julien,




回答2:


In win 7 , 64 bit, openCV 2.4

GpuMat --> Mat:

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

As you can see dst is GpuMat, and tran is Mat.



来源:https://stackoverflow.com/questions/6965465/how-to-convert-gpumat-to-cvmat-in-opencv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!