Open CV OpenCL error occurred....

The OpenCV error of

"OpenCV Error: Assertion failed (clEnqueueWriteBuffer(q, (cl_mem)u->handle, CL_TRUE, dstrawofs, total, alignedPtr.getAlignedPtr(), 0, 0, 0) >= 0) in cv::ocl::OpenCLAllocator::upload, file ..\..\..\modules\core\src\ocl.cpp, line 4960" occured in my OpenCV program to detect keypoints using ORB.

The error occured on the laptop PC of ThinkPad X1 Carbon. However, the error did not occur on the desktop PC with a NVIDIA video board.

The serious problem was that the physical memory usage increases over time while keypoints were being detected by using ORB.  I found a solution in the following site:
https://github.com/opencv/opencv/issues/5815


The solution steps are as follows:

1) Include the file of ocl.hpp

#include <opencv2/core/ocl.hpp>

2) Add the following code at the first position of the loop of a while sentence


while(1){

   BufferPoolController* c = cv::ocl::getOpenCLAllocator()->getBufferPoolController();
  
   if (c){
       c->setMaxReservedSize(0);
   }


  
    /////// code for the other processing //////////



}




Comments

Popular posts from this blog

メールクライアントソフトBecky!の表示フォントを変更

Microsoft プロダクトキーの種類