-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Missing function to copy cv::Umat to cv::ocl::Image2D without allocating space on device #19140
Copy link
Copy link
Closed
Labels
Description
I'm experimenting with using OpenCV to launch my own openCL kernels.
Everything works fine so far, I followed this example: https://stackoverflow.com/a/28644721
However it seems that passing a UMat to the kernel as a const image2d_t requires
cv::ocl::Image2D image(umat_src);But this will both allocate memory and perform the UMat to Image2D copy:
opencv/modules/core/src/ocl.cpp
Line 7105 in b5a9ef6
| handle = clCreateImage2D(context, CL_MEM_READ_WRITE, &format, src.cols, src.rows, 0, NULL, &err); |
opencv/modules/core/src/ocl.cpp
Line 7134 in b5a9ef6
| CV_OCL_CHECK(clEnqueueCopyBufferToImage(queue, devData, handle, 0, origin, region, 0, NULL, 0)); |
But if you want to process data in a loop and call the kernel multiple times, then Image2D constructor will keep allocating memory and device until it is full. A copy function would solve this.
Or am I doing it wrong?
Reactions are currently unavailable