小编Dri*_*ian的帖子

将Mat传递给OpenCL内核会导致分段错误

我想将OpenCL Mat传递给FGPA的手写OpenCL内核(不支持OpenCV OpenCL)。

主机代码:

Mat img = imread( "template.jpg", IMREAD_GRAYSCALE );
Mat output(img.rows, img.cols, CV_8UC1);
// Program, Context already declared
// Create Kernel
cl_kernel kernel = NULL;
kernel = clCreateKernel(program, "copy", &status);
// Create Command Queue and associate it with the device you want to execute on
cl_command_queue cmdQueue;
cmdQueue = clCreateCommandQueue(context,devices[0], 0,  &status);

// Buffer, prob i do something wrong here
cl_mem buffer_img = clCreateBuffer(context,CL_MEM_READ_ONLY, sizeof(uint) * img.cols * img.rows,    NULL,&status);
cl_mem buffer_outputimg = clCreateBuffer(context,CL_MEM_WRITE_ONLY, sizeof(uint) * img.cols * …
Run Code Online (Sandbox Code Playgroud)

opencv image-processing opencl segmentation-fault mat

5
推荐指数
1
解决办法
342
查看次数