A few weeks ago I found this tutorial on hand gesture detection for opencv and javacv. I started using the example but kept running into the same error over and over again.
Here is the error :
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_objdetect in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
at com.googlecode.javacpp.Loader.load(Loader.java:489)
at handDectector.Handy.<init>(Handy.java:32)
at handDectector.Handy.main(Handy.java:56)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_objdetect248 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
at com.googlecode.javacpp.Loader.load(Loader.java:481)
I read a lot of posts online related problems online related to this issue where people found the same javacpp and javacv file. I tried doing that a couple of times, but it didn't work.
Here is the code :
package handDectector;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.opencv.core.Core;
import java.io.*;
import com.googlecode.javacv.*;
import com.googlecode.javacv.cpp.*;
import com.googlecode.javacpp.Loader;
public class Handy extends JFrame
{
// GUI components
private HandPanel handPanel;
public Handy()
{
super("Hand Detector");
Container c = getContentPane();
c.setLayout( new BorderLayout() );
// Preload the opencv_objdetect module to work around a known bug.
Loader.load(opencv_objdetect.class);
handPanel = new HandPanel(); // the webcam pictures and drums appear here
c.add( handPanel, BorderLayout.CENTER);
addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e)
{ handPanel.closeDown(); // stop snapping pics, and any drum playing
System.exit(0);
}
});
setResizable(false);
pack();
setLocationRelativeTo(null);
setVisible(true);
} // end of Handy()
// -------------------------------------------------------
public static void main( String args[] )
{
new Handy();
}
} // end of Handy class
The problem lies in the opencv_obj file not being present.
I don't have much experience with this library at all. Is it possible if anyone could help me fix the problem? I know for sure there are posts on github and stackoverflow about the same exact problem... But they all use maven. Is it possible to do it without maven?