I have searched the Internet for a long time without finding the answer, please help me, thank you!
//win10 + java + opencv_java2413
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
OpenCV.loadLocally();//must be added otherwise an exception will be reported
Mat source = Imgcodecs.imread(sourcePath, Imgcodecs.IMREAD_COLOR);
Mat template = Imgcodecs.imread(path,Imgcodecs.IMREAD_COLOR);
Mat outputImage = new Mat();
Imgproc.matchTemplate(source, template, outputImage, MACH_METHOD);// unknow exception
First of all, thank you very much for your reply
1ăI am maintaining a 5 year old project, so I am not in a position to update the software version immediately.
2ăThe matchTemplate function only returns the âjava.lang.Exception:unknow exceptionâ.
3ă
loadLocally is used to solve "Method threw âjava.lang.UnsatisfiedLinkErrorâ exception.
4ăwhatâs mean for loadLocally, according to the notes, I understand that it allows the program to load the âdllâ file from the âclasspathâ environment variable
You know, maintaining an old project can be a pain, both in terms of meeting deadlines and understanding the technologies used in the project.
Yes, Iâm sure thereâs nothing wrong with the images, because I took the code and images from the project to the âdemoâ project and it works correctly
Guys, I fixed the problem!
The previous programmer referenced the wrong âdllâ file!
When generating the âjarâ file, remember to use the âbuildâ operation