Ask Your Question
0

Error creating oclmat of CV_8UC3 datatype

asked 2013-09-27 20:25:15 -0500

updated 2013-09-28 00:37:37 -0500

Moster gravatar image

Hello, I am getting an CL_INVALID_VALUE error in a test program where I am trying to create an 'oclmat' structure from a 4000x3000 image that is 24-bit RGB. I believe this corresponds to the CV_8UC3 type.

My code looks like this:

IplImage* src = cvLoadImage("c:\\mediaworkloads\\JIVE.JPG",CV_LOAD_IMAGE_COLOR);
ocl::oclMat oclSrc(src->height, src->width, CV_8UC3, src);

I noticed when debugging into the oclMat constructor that it adds "tail_padding" of 3072 and ends up creating a buffer of size 3600768 when my original image is 3600000 bytes. What is that for? Does the OpenCL buffer width need to be divisible by 1024 bytes?

The fault occurs on line 468 of 'initialization.cpp', on the clEnqueueWriteBuffer call. This suggests that the region being written to is out of bounds. How do I fix this?

Thanks.... Mike

edit retag flag offensive close merge delete

Comments

1

Im not really sure if oclMat can handle the input type IplImage. Why dont you use a Mat with cv::imread or just Mat help(src) which creates a Mat from IplImage?

Moster gravatar imageMoster ( 2013-09-28 00:33:01 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-10-20 14:21:52 -0500

Ilya Lavrenov gravatar image

updated 2013-10-20 14:25:01 -0500

Hello, when you create oclMat or Mat using user allocated data, you should pass pure pointer to data:

ocl::oclMat oclSrc(src->height, src->width, CV_8UC3, src->imagedata);

OpenCL buffer width need to be divisible by 1024 bytes?

No, it is not needed.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-09-27 20:25:15 -0500

Seen: 225 times

Last updated: Oct 20 '13