0

I have the code that is for to take snapshot but i am facing the problem of 'no opencv_java in java.library.java'. I have tried the all methods of opencv (install it, setup the .dll file, seted up .so file) but as like as before the problem remain same.

import org.opencv.core.*;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;

public class web
{
    public static void main(String args[])
    {

        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        VideoCapture camera = new VideoCapture(0);
        if (!camera.isOpened())
        {
            System.out.println("Error");
        }
        else
        {
            Mat frame = new Mat();
            while (true)
            {
                if (camera.read(frame))
                {
                    System.out.println("Frame Obtained");
                    System.out.println("Captured Frame Width " +
                                       frame.width() + " Height " + frame.height());
                    Highgui.imwrite("camera.jpg", frame);
                    System.out.println("OK");
                    break;
                }
            }
        }
        camera.release();
    }
}

Now how can I overcome this problem, I have already did the NATIVE library path -Djava.library.path="C:\path to the .dll file"

3
  • Which version of opencv are you using? Commented Jun 16, 2017 at 11:13
  • opencv 249* Commented Jul 11, 2017 at 18:18
  • Try this answer, maybe it can work for you too: stackoverflow.com/a/42996093/7478712 Commented Jul 21, 2017 at 16:35

1 Answer 1

0

I'm using fedora linux and i installed the opencv-java package using the package manager "dnf" then i got the same error so i just created some directories /usr/java/packages/lib then i copied the whole content of the /lib/java/ into the dirs that created . and it SOLVED my probled

give it a try

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.