I am using OpenCV 3.0 (the latest version) in Java, but when I use SURF algorithm or SIFT algorithm it doesn\'t work and throws Exception which says: OpenCV Error: Bad
That is because they are not free in newer versions of OpenCV (3+). I faced that problem few time ago. You have to:
cmake -DBUILD_SHARED_LIBS=OFF
specifying the nonfree part with DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules
option and build with make -j8
(or whatever Java version you use) features2d_manual.hpp
file, including opencv2/xfeatures2d.hpp
and including the necessary code for SIFT and SURF case
, which are commented and not defined:
fd=xfeatures2d::SIFT::create();
for SIFT descriptor andde = xfeatures2d::SIFT::create();
for SIFT extractor. Do the same for SURF if you want to use it too.I wrote this post explaining step by step how to compile the nonfree OpenCV part in order to use privative tools like SIFT or SURF. Compile OpenCV nonfree part