java.lang.UnsatisfiedLinkError when using binaries built from source.
I just built the opencv-300.jar
and opencv_java300.dll
from source with extra modules from the opencv contrib repo
. I used the jar and dll in my Java project. But it reports the following error when I try to create the BRISK DescriptorExtractor
.
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.features2d.DescriptorExtractor.create_0(I)J
at org.opencv.features2d.DescriptorExtractor.create_0(Native Method)
at org.opencv.features2d.DescriptorExtractor.create(DescriptorExtractor.java:127)
at mainPkg.MainApp.MatchExperiment(MainApp.java:54)
at mainPkg.MainApp.main(MainApp.java:45)
***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****
Based on my understanding of the UnsatisfiedLinkError
, it seems the native method DescriptorExtractor.create_0()
cannot be found.
Any hint is appreciated...
Add 1
Based on my limited JNI knowledge, I started to search for the JNI declarations in the source code of OpenCV extra modules. It is org.opencv.features2d.DescriptorExtractor
missing. So I searched for Java_org_opencv_features2d_DescriptorExtractor
. And just as expected, it is not found. So it is never exported as JNI. So I cross my fingers and start to recall... Based on my limited experience with Machine Learning, I remember the jargon feature
is intimately related to it. And I remembered I glimpsed some ml
in the CMake configuration for OpenCV. So I go through the configuration entries and found this:
BUILD_opencv_ml
And it is NOT selected.
So I checked it. And regenerated the VS project files. And this time I found the Java_org_opencv_features2d_DescriptorExtractor
.
Now I am crossing my fingers again and waiting for the new build to complete... Hopefully, it will work...
Hi, I have the exact same problem after building the wrapper for Java. Did it worked? In case it didn't, can you provide a idea? I'm stuck at this problem.
Thanks!