1

I work on project to apply meanshift in opencv on some images, after four or five tries i get this error, i tried something like closing configuration and so on but none of them doesn't work. any help appreciate it. my opencv 2.4.9, and my graphic cart is NVIDIA GeForce 310.

OpenCV Error: Gpu API call (CL_INVALID_COMMAND_QUEUE) in openCLMemcpy2D, file /tmp/buildd/ros-hydro-opencv2-2.4.9-2precise-20140617-1410/modules/ocl/src/cl_operations.cpp, line 227
[ERROR] [1405642960.704963701]: Exception thrown while processing service call: /tmp/buildd/ros-hydro-opencv2-2.4.9-2precise-20140617-1410/modules/ocl/src/cl_operations.cpp:227: error: (-217) CL_INVALID_COMMAND_QUEUE in function openCLMemcpy2D

[ERROR] [1405642960.705466283]: Service call failed: service [/jur_segmentation_interaction] responded with an error: /tmp/buildd/ros-hydro-opencv2-2.4.9-2precise-20140617-1410/modules/ocl/src/cl_operations.cpp:227: error: (-217) CL_INVALID_COMMAND_QUEUE in function openCLMemcpy2D

=================> code

/// Applying MeanShift
cv::ocl::oclMat ocl_image;
cv::Mat res_mean;

// Converting to CV_8UC4
cv::Mat _img_conv;
cvtColor( _img , _img_conv , CV_BGR2BGRA );

ocl_image.upload(_img_conv.clone());

cv::ocl::meanShiftSegmentation( ocl_image.clone() , res_mean , _sp , _sr , _mean_size );
//cv::ocl::finish();

====================> opencl configuration:

cv::ocl::DevicesInfo dev_info;
cv::ocl::getOpenCLDevices( dev_info );

/// Platform Info
cv::ocl::PlatformsInfo plat_info;
cv::ocl::getOpenCLPlatforms( plat_info );

cv::ocl::setDevice( dev_info[0] );
Javier
  • 12,100
  • 5
  • 46
  • 57
Vahid
  • 76
  • 6
  • As mentioned by others on http://stackoverflow.com/questions/24761665/what-could-cause-this-pyopencl-logicerror-clenqueuereadbuffer-failed-invalid-c you can get errors like this if kernels are not executing correctly. Try adding clFinish after each clEnqueue* operation to allow it to finish and see if the error shows up sooner, which will help you find the problem. Otherwise start removing or simplifying host or device code to narrow down the cause. – Dithermaster Jul 18 '14 at 18:04
  • as i said i don't work with opencl directly, just i used from meanshift segmentation that uses opencl, i've added the my code, may be it helps more. – Vahid Jul 18 '14 at 21:16
  • i guess you are not passing the data correctly to opencl. unfortunately i have little experience with meanshift. what about meansize etc? – Philipp Braun Jun 18 '15 at 20:50

1 Answers1

0

This sometime happened when you call code in separate thread.

Ehsan Jelodar
  • 1,544
  • 19
  • 25