Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnsatisfiedLinkError while executing new Mat()

i am currently trying to code a little program to take picture of newly students and save them by their names etc to ease the inscriptions things etc.

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

I can run this project with no error but when i try to import some code to 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

The error occurs when i execute theses lines:

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

Here are my imports in case it could help to find 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;

While compilation i got this message, dunno if related or so

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

Both error appears (i guess) when Mat() is called but i cannot find how to fix this.

I should really use some helps or tips here! Thanks for reading this and sorry for my bad english!

like image 322
Neithalf Avatar asked Jun 05 '15 10:06

Neithalf


1 Answers

Finaly solved my problem, the fact was that i called

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

too late, so i moved it a bit and solved that :) Thanks for all who spend a bit of their time to help me there!

like image 123
Neithalf Avatar answered Sep 20 '22 17:09

Neithalf