Hi,
As the title suggests, I’m trying to download a cv::cuda::GpuMat gpuMat
to cv::Mat cpuMat
by calling cudaMemcpyAsync.
cv::Mat cpuMat(gpuMat.size(), CV_8UC3);
checkCudaErrorCode(cudaMemcpyAsync(
cpuMat,
gpuMat.cudaPtr(),
gpuMat.cols * gpuMat.rows * gpuMat.channels() * CV_ELEM_SIZE1(gpuMat.type()),
cudaMemcpyDeviceToHost,
stream
), __func__);
checkCudaErrorCode(cudaStreamSynchronize(stream), __func__);
But then when try write cpuMat
to file using cv::imwrite
, it turns out gibberish.
I check if gpuMat
’s data is corrupted with the conventional and there doesn’t seem to be a problem.
gpuMat.download(cpuMat)
Do you have any idea?
Thanks in advance.