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?
By default, each of the OpenCV CUDA algorithms uses a single GPU. If you need to utilize multiple GPUs, you have to manually distribute the work between GPUs.
In OpenCV the main matrix class is called Mat and is contained in the OpenCV-namespace cv. This matrix is not templated but nevertheless can contain different data types. These are indicated by a certain type-number. Additionally, OpenCV provides a templated class called Mat_, which is derived from Mat.
The Mat class of OpenCV library is used to store the values of an image. It represents an n-dimensional array and is used to store image data of grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms, etc.
CV_64F is the same as CV_64FC1 . So if you need just 2D matrix (i.e. single channeled) you can just use CV_64F. EDIT. More generally, type name of a Mat object consists of several parts.
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,
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With