2015-07-16 14:01:45 -0600 | commented answer | OpenCV OpenCL- Where is creation of context? Hi, thanks for the answer! I've read through most of those links and they're pretty helpful in understanding how I can use Context, Kernel and Program classes to execute my own kernels. What I'm more curious about is how OpenCV runs its own kernels. The best example I can give is cvtColor. Color conversions are one area that OpenCV has enabled OpenCL for. Reading through the code, I see how the cv::cvtColor function decides whether to use the CPU implementation or the GPU implementation. Once it decides to use GPU implementation, it calls the function ocl_cvtColor. My question: inside this function, there is no mention of a context being created. Where does OpenCV do this setup? Do they do it at all? Is OpenCV creating and running a kernel without a context?? |
2015-07-15 12:33:09 -0600 | answered a question | Weird behavior of ocl matrix in opencv The printf probably makes the kernel fail to compile and defaults to using the CPU. This happened to me when I tried adding a printf statement. There's a certain way printf's need to be added. Check this link out: https://www.khronos.org/registry/cl/e... Again, check to make sure after adding printf that your code is ACTUALLY calling the kernel successfully. |
2015-07-15 12:30:33 -0600 | asked a question | OpenCV OpenCL- Where is creation of context? I'm using OpenCV OpenCL and I've been tracing the code that gets executed when OpenCL is on. I see the creation of a kernel, filling the kernel args and running the kernel, but I see no setup in terms of creating a context and program. Where does this happen, if at all? For example, in /modules/imgproc/src/color.cpp, I see that cv::cvtColor calls ocl_cvtColor. Inside ocl_cvtColor, I see how the kernel is set up and run, but there isn't any mention of a context. I thought a context is necessary for OpenCL programs to run on the GPU. |
2015-07-09 23:49:39 -0600 | asked a question | Enable OpenCV-OpenCL on Android devices I'm trying to figure out how to enable OpenCL on an Android device. I've built opencv so that OpenCL is YES. I've tried some functions like cv::ocl::setUseOpenCV(true) and haveOpenCL() and they all seem to indicate that OpenCL kernels are now available to use through calls to OpenCV. I'm trying to convert the following code so that it runs on the GPU with OpenCV. I'm just trying to convert an image from the camera on an android phone to one that is RGB. That's all. (Ignore the line numbering). BEFORE: AFTER: I get a black screen. Any idea why? |