OpenCV Libraries within .cl Files


So I’ve an application written in C++ that makes use of the OpenCV libraries to do some video processing. I’m interested in using OpenCL to achieve some parallelism to improve performance.

Is it possible to use OpenCV libraries within .cl files? Before trying to do anything, I just tried adding this include to my .cl file from a simple Hello World application. I received the error below upon running it.

#include <cv.h>

#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
__constant char hw[] = "Hello World
__kernel void hello(__global char * out)
    size_t tid = get_global_id(0);
    out[tid] = hw[tid];
ERROR: Kernel::Kernel() (-46)

I have included all the necessary paths/libraries in my build settings for both OpenCL and OpenCV. Any help would be appreciated!

have you appropriately compiled the file with the make command?

I’m sorry. It’s not possible to link against external libraries inside a kernel program. In particular, you can’t call OpenCV functions inside an OpenCL kernel.

Thanks for the replies. I am now aware of that and am looking into converting the frames into cl::Image2D.