Use OpenCL feature detector.
How to use OpenCL based feature detector? According to the source code (here) There is opencl version of AKAZE,FAST and ORB. I want to know how to use them in C++ ?
I tried importing #include <opencv2/core/ocl.hpp>
and then I also set cv::ocl::setUseOpenCL(true);
and for sanity check I did cv::ocl::haveOpenCL()
. Doing these I can confirm I've built OpenCV with OpenCL support.
That being said I tried converting all cv::Mat
to cv::UMat
. Now the program crashes at detector->detectAndCompute(umat, cv::noArray(), kp1, des1);
. I'm using AKAZE.
The error on the console is:
OpenCV(4.0.0-dev) Error: Requested object was not found (could not open directory: C:\Users\PC\AppData\Local\Temp\opencv) in glob_rec, file e:\cv4.0\opencv\modules\core\src\glob.cpp, line 267
The callstack error says :
- _err "could not open directory: C:\Users\PC\AppData\Local\Temp\opencv" const std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
I've initialised it like this:
detector = cv::AKAZE::create();
detector->setThreshold(akaze_thresh);
Is this is the right way to use OpenCL version of AKAZE? If yes, how do I fix the error? If not, how do I use OpenCL version of AKAZE?
I tried this :
No exception. Can you give platform and opencv version used?
Windows 10, Visual Studio 2017, OpenCV 4.0. Shouldn't des1 also be a UMat?
what a weird error. can you take a look, if
C:\Users\PC\AppData\Local\Temp\opencv
exists ? it should contain a.lock
file, and a folder named similar toIntel_R__Corporation--Intel_R__HD_Graphics--10_18_10_4276
(hw vendor) ?That folder doesn't exist.
opencv tries to cache compiled opencl kernels there. do you (your program) have write access to it ?
How do I check this or make sure it does?
"That folder doesn't exist." ? Have you got C:\Users\PC\AppData\Local\Temp\opencv?
or Have you got C:\Users\PC\AppData\Local\Temp\?
or
Have you got C:\Users\PC\AppData\Local?
I've got "C:\Users\PC\AppData\Local\Temp\"
Can you check security attribuet in folder properties ? stack trace is here
@LBerger, how did you get that trace ?
@Rakshith, maybe run a little test prog like:
in DEBUG mode, you should see output like this: