opencv-java / getting-started

Getting started with OpenCV and JavaFX
105 stars 176 forks source link

InvocationTargetException thrown in defining the VideoCapture Object #13

Open amarlearning opened 6 years ago

amarlearning commented 6 years ago

InvocationTargetException is thrown in creating an instance of VideoCapture class.

Operating System: Ubuntu 16.04
JDK Version : JDK 1.8.152

screenshot from 2018-03-11 13-26-30

screenshot from 2018-03-11 13-27-00

luigidr commented 6 years ago

It seems that the problem is in the linking between the Java method and the underlying C++ function.

Which IDE are you using? Do you properly set up the location of the native library for the OpenCV jar? e.g., http://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html#set-up-opencv-for-java-in-eclipse?

amarlearning commented 6 years ago

Did you used the pre-compiled version of OpenCV in Ubuntu?

@luigidr I downloaded the 3.4.1 source folder of OpenCV from here and then installed it using CMake and Apache Ant.

Which IDE are you using?

I am using Eclipse Oxygen.2 Release (4.7.2).

Do you properly set up the location of the native library for the OpenCV jar?

Native library for the OpenCV jar path : /opencv-3.4.1/builds/lib. I think its correct because this (http://opencv-java-tutorials.readthedocs.io/en/latest/02-first-java-application-with-opencv.html#create-a-simple-application) is running fine. I think the native library path for OpenCV jar is correct.

luigidr commented 6 years ago

Thanks, @amarlearning. I just tried the program with the same OpenCV version and IDE on macOS and Windows and it works without any problem.

Are you using the OpenJDK? Does this program work: https://github.com/opencv-java/fourier-transform? It doesn't use VideoCapture but it's made with JavaFX: I would like to exclude any problem with your environment (JDK, JavaFX, ...) before trying this program in Ubuntu.

amarlearning commented 6 years ago

Are you using the OpenJDK?

I am using the Oracle version.

Does this program work: https://github.com/opencv-java/fourier-transform?

I will try to run this program and will respond back to you.