SURF和SIFT算法在Open CV 3.0 Java中不起作用

时间:2016-05-29 05:19:14

标签: java opencv opencv3.0 sift surf

我从github repo

合并了opencv和opencv-contrib

我的操作系统是Windows 8.1

请按以下步骤操作:

1.下载Github Repo。

opencv (Itseez/opencv)
opencv_contrib (Itseez/opencv_contrib)

D:\opencv_merge\opencv-master
D:\opencv_merge\opencv_contrib-master

2。下载并安装CMake Lastest Version(当前版本为3.5.2)

3。 CMake Generate

(1)
Open CMake GUI 
setting path
source code: D:\opencv_merge\opencv-master
build the binaries: D:\opencv_merge\opencv-master\build
(2)
press 'Configure' 
wait for 'Configuring done'

watch output
---------------------

OpenCV modules:
    To be built:                 core flann hdf imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco java optflow stitching matlab python2
    Disabled:                    world contrib_world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python3 viz cvv sfm

 Java:
    ant:                         C:/apache-ant-1.9.7/bin/ant.bat (ver 1.9.7)
    JNI:                         C:/Program Files/Java/jdk1.8.0_91/include C:/Program Files/Java/jdk1.8.0_91/include/win32 C:/Program Files/Java/jdk1.8.0_91/include
    Java wrappers:               YES
    Java tests:                  YES

(3)设置OPENCV_EXTRA_MODULES_PATH

D:/opencv_merge/opencv_contrib-master/modules

press 'Configure' 
watch output double check again

(4)生成

4。打开OpenCV.sln

'Solution Explorer' CMakeTargets-->Install -->Right Click -->Build

5。获取opencv-310.jar和opencv_java310.dll

(D:\opencv_merge\opencv-master\build\install\java)

6。 Netbeans设置

(1) add Opencv Library (add opencv-310.jar to Library)
(2) VM options: -Djava.library.path=D:\opencv_merge\opencv-master\build\install\java

7。运行项目

8。写一些代码:

public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
.....
FeatureDetector orbDetector = FeatureDetector.create(FeatureDetector.ORB);
.....
FeatureDetector siftDetector = FeatureDetector.create(FeatureDetector.SIFT);
.....
FeatureDetector surfDetector = FeatureDetector.create(FeatureDetector.SURF);
}

9。运行项目和测试

ORB检测器可以执行(当然)

但是SIFT和SURF探测器不能

enter image description here

我看到这种情绪后做了一些修改:(SURF and SIFT algorithms doesn't work in OpenCV 3.0 Java

我根据上述网址编辑'D:\opencv_merge\opencv-master\modules\features2d\misc\java\src\cpp\features2d_manual.hpp',然后开始第二步。

然而,在第五步中,在java文件夹(D:\opencv_merge\opencv-master\build\install\java)中找不到'opencv_java310.dll' 我尝试重复相同的步骤至少5次,但仍然没有'opencv_java310.dll'

原因似乎是我手动更改了'features2d_manual.hpp'

我整天都在外面:(

谁能帮我解决这个问题

谢谢你们

1 个答案:

答案 0 :(得分:1)

猜测您的问题是您需要在手动修改features2d_manual.hpp后重新编译。这对我有用。

您可以在SURF and SIFT algorithms doesn't work in OpenCV 3.0 Java

中查看我的答案