opencv的features2d包中提供了surf,sift和orb等特征点算法,根据测试结果发现在opencv3.0的java版本中存在一些bug,导致surf算法无法使用,会抛出如下异常:
代码语言:javascript复制OpenCV Error: Bad argument (Specified feature detector type is not supported.) in cv::javaFeatureDetector::create, file C:/build/master_winpack-bindings-win64-vc14-static/opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp, line 155
Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: C:/build/master_winpack-bindings-win64-vc14-static/opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp:155: error: (-5) Specified feature detector type is not supported. in function cv::javaFeatureDetector::create
]
at org.opencv.features2d.FeatureDetector.create_0(Native Method)
at org.opencv.features2d.FeatureDetector.create(FeatureDetector.java:88)
外网也有人发现此问题:https://stackoverflow.com/questions/30657774/surf-and-sift-algorithms-doesnt-work-in-opencv-3-0-java
补充:
OpenCV 中和 2D 特征检测相关的算法的头文件位于opencvmodulesfeatures2dincludeopencv2features2d.hpp,除SIFT、SURF以外的特征。opencvmodulesnonfreeincludeopencv2nonfreefeatures2d.hpp,只包含SIFT、SURF这两个受专利保护的特征,因此不是免费的(nonfree)。但是jar包中依然存在调用关系。