Ask Your Question


asked 2015-10-13 09:40:08 -0500

cannon_dt gravatar image

Hi, When I tried a simple face detection code in Java I ran into the foll for some images only: OpenCV Error: Assertion failed (retval == CL_SUCCESS) in cv::ocl::OpenCLBufferPoolImpl::_allocateBufferEntry, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\ocl.cpp, line 3990 OpenCV Error: Assertion failed (u != 0) in cv::UMat::create, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\umatrix.cpp, line 274

I dont know why this was happening?

Upon doing some research I found that I have to setUseOpenCL to false to overcome this. However I am unable to locate where this API is defined? Can someone please help?

Thanks, Ananth

edit retag flag offensive close merge delete


What if we dont want to set OPENCL to OFF?

thefakhir gravatar imagethefakhir ( 2017-05-24 06:23:57 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-13 19:35:13 -0500

To disable the usage of OpenCL just include the header file opencv2\core\ocl.hpp and put cv::ocl::setUseOpenCL(false) somewhere at the beginning of your program.The implementation of setUseOpenCL function is in the source code file modules/core/src/ocl.cpp.

edit flag offensive delete link more


I cannot find this as a Java API, the Core class does not have it (I am developing this using Eclipse/openCV 3.0)

cannon_dt gravatar imagecannon_dt ( 2015-10-13 22:37:04 -0500 )edit

I have little experience with Java: rebuild OpenCV with WITH_OPENCL set to OFF.

tuannhtn gravatar imagetuannhtn ( 2015-10-14 01:12:34 -0500 )edit

Thank you. I did that and it works ok now.

cannon_dt gravatar imagecannon_dt ( 2015-10-14 08:14:26 -0500 )edit

Then, accept the answer as a solution to help others to recognize your question as being solved.

tuannhtn gravatar imagetuannhtn ( 2015-10-14 09:54:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-10-13 09:40:08 -0500

Seen: 1,721 times

Last updated: Oct 13 '15