UnsatisfiedLinkError when executing new Mat ()

I am currently trying to code a small program to take pictures of new students and save them by name, etc., in order to facilitate inscriptions, etc.

So, here is my problem, I found a great tutorial that will help me use the webcam: http://www.codeproject.com/Tips/717283/How-to-use-OpenCV-with-Java-under-NetBeans-IDE

I can run this project without errors, but when I try to import the code for mine, I got this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J at org.opencv.core.Mat.n_Mat(Native Method) at org.opencv.core.Mat.<init>(Mat.java:24) at recupphoto.Ihm.<init>(Ihm.java:38) at recupphoto.RecupPhoto.main(RecupPhoto.java:19) Java Result: 1 

An error occurs when I execute these lines:

 Mat frame = new Mat(); MatOfByte mem = new MatOfByte(); 

Here is my import, if it can help figure out:

 import java.util.ArrayList; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; import javax.swing.JOptionPane; import javax.swing.UIManager; import org.opencv.core.Mat; import org.opencv.core.MatOfByte; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.videoio.VideoCapture; 

At compile time, I received this message, dunno if related or so

Note. Some input files use unverified or unsafe operations. Note. Recompiling with -Xlint: unchecked for details.

Both errors appear (I think) when Mat () is called, but I cannot find how to fix this.

I really have to use some tips or tips here! Thanks for reading this and sorry for my poor english!

+6
source share
2 answers

Finaly solved my problem, the fact was what I called

 System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 

too late, so I moved it a bit and decided that :) Thanks to everyone who takes a little time to help me there!

+8
source

Step 1 Get the addiction walking app.

Step 2 Navigate to the appropriate library folder.

Step 3 See what is missing and get it.

Tips:

Ensure that your 32-bit or 64-bit is installed for your DLL architecture.

Be sure to compile with proper java (32 bit / 64 bit) depending on which DLL you provide.

Finally, if missing dependencies start with MSVCP ***. dll download Microsoft Visual C ++ Packages . Let's take care of architecture again. I recommend you start with this step.

0
source

Source: https://habr.com/ru/post/988568/


All Articles