Lokendra
Lokendra

Reputation: 79

javacv code not running

I have been trying this for a long time. I have installed all the prerequisites.
1. Installed java jdk first
2. Installed Microsoft Visual C++ redistributable package
3. Downloaded opencv package
4. Set OpenCV .dll in systems path.
5. Downloaded JavaCV- bin from link below and extract it.
6. Finally added all external JAR files to the eclipse Libraries.

Below is the demo code which I'm using for testing javacv

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import com.googlecode.javacv.CanvasFrame;

public class demo {

    public static void main(String[] args) {

     //Load image img1 as IplImage
        final IplImage image = cvLoadImage("backimg.png");

        //create canvas frame named 'Demo'
        final CanvasFrame canvas = new CanvasFrame("Demo");

        //Show image in canvas frame
        canvas.showImage(image);

        //This will close canvas frame on exit
        canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);        
    }    
}

Now when I run the project as a Java Application the following dialog box appears (included in the link below) :-

Dialog box that appears in eclipse

Now I've tried all the options shown in the dialog box but the code is not running. It would be a great help if anyone could tell me what option should I select in the dialog box and the correct procedure for running the code if I'm wrong somewhere.

Upvotes: 1

Views: 281

Answers (2)

rohit kochar
rohit kochar

Reputation: 66

Sometimes the "java.lang.UnsatisfiedLinkError" can occur due to a mismatch in the version of JavaCV jars and required OpenCV libraries. You can check the required version of OpenCV in the Readme file of javacv-bin

Upvotes: 1

Usman Saleem
Usman Saleem

Reputation: 1655

select 'demo - (default package)' from the list. Eclipse is asking you to select from the classes which contain main method.

Upvotes: 1

Related Questions