Ask Your Question

patrobic's profile - activity

2017-08-09 09:02:06 -0600 received badge  Enthusiast
2017-07-27 17:42:35 -0600 commented question How to pass an already stored data in GPU by GpuMat to a kernel

This is my first post here; I made an account just to comment on this! I too am observing this exact behavior, I have tried every possible way of passing the GpuMat to the kernel as a float* pointer, but regardless only the first third or so of the image (roughly 1500 bytes) is valid, the rest is zero.

I tried: Allocating a local GpuMat and using copyTo() to copy the original GpuMat data manually there. *Allocate a float with cudaMalloc(), and using cudaMemcpy(...DeviceToDevice) to store the raw data. *Using both gpumat.ptr<float>(); and gpumat.data() functions.

The only thing that works is copying the data to Host memory, then back to a GpuMat using gpumat.download(mat), then using cudaMemcpy(...HostToDevice) to copy it to a float*. I can only conclude that this is a bug with OpenCV!