OpenCV3: where has cv::cuda::Stream::enqueueUpload

2019-02-19 09:08发布

问题:

In former versions of OpenCV there was the function Stream::enqueueUpload that could be used to upload data to the GPU asynchronously together with CudaMem (compare: how to use gpu::Stream in OpenCV?). However, this function does no longer exist in OpenCV 3. The CudaMem class is also gone but seems to have been replaced by the HostMem class.

Can anyone tell me how to perform an asynchronous upload in OpenCV 3?

回答1:

It can be done now via void GpuMat::upload(InputArray arr, Stream& stream) method:

cv::cuda::GpuMat d_mat;
cv::cuda::HostMem h_mat;
cv::cuda::Stream stream;
d_mat.upload(h_mat, stream);