IJ-OpenCV icon indicating copy to clipboard operation
IJ-OpenCV copied to clipboard

Cannnot get IJ-OpenCV to run with latest bytedeco.javacpp release

Open imagingbook opened this issue 8 years ago • 4 comments

Hi Jonathan, I was hoping that IJ-OpenCV can be used in ImageJ's plugin 'Compile-and-run' mode and indeed it does :-), but apparently only with older versions of the OpenCV jar files. However, when I use the current release JARs, i.e., with the files

  • javacpp-1.3.jar
  • javacv-1.3.jar
  • opencv-3.1.0-1.3.jar
  • opencv-3.1.0-1.3-windows-x86_64.jar
  • scijava-common-2.61.0.jar

(placed in ImageJ/jars), OpenCV hangs endlessly. After doing one "Compile-and-run" on the plugin, direct invocation from the plugins menu also hangs. For easier testing, I use the following plugin:

import org.bytedeco.javacpp.opencv_core.Mat;

import ij.IJ;
import ij.plugin.PlugIn;

public class Test_Installation implements PlugIn {

	@Override
	public void run(String arg0) {
		IJ.log("Starting OpenCV Test ...");
		IJ.log("OpenCV version = " + org.bytedeco.javacpp.opencv_core.CV_VERSION);
		IJ.log("Number of CPUs = " + org.bytedeco.javacpp.opencv_core.getNumberOfCPUs());		
		Mat mat = Mat.eye(3, 3, org.bytedeco.javacpp.opencv_core.CV_8UC1).asMat();
		IJ.log("mat = " + mat.toString());
	}
}

On my machine this gives

Starting OpenCV Test ...
OpenCV version = 3.1.0
Number of CPUs = 4
mat = org.bytedeco.javacpp.opencv_core$Mat[width=3,height=3,depth=8,channels=1]

As said, it works smoothly with older releases (javacpp-1.1 and opencv-3.0). Could be a class loader problem? I am running Oracle JRE 1.8.0_65 (16 bit) on Win7. Any ideas/recommendations?

--Wilhelm

imagingbook avatar Jan 22 '17 17:01 imagingbook

Did another test with an older OpenCV version (1.1), using the following dependency in my POM:

<!-- https://mvnrepository.com/artifact/org.bytedeco/javacv -->
<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv</artifactId>
    <version>1.1</version>
</dependency>

I manualy copied the associated Maven artefacts to Image/jars:

  • javacpp-1.1.jar
  • javacv-1.1.jar
  • opencv-3.0.0-1.1.jar
  • opencv-3.0.0-1.1-windows-x86_64.jar

With this setup everything works nicely, compile-and-run does not hang. Works with javacv version 1.2 too!

imagingbook avatar Jan 22 '17 17:01 imagingbook

Dear Wilhelm,

thanks for letting me know about this issue with the different versions. I will try to fix it as soon as possible.

Best, Jónathan

2017-01-22 18:56 GMT+01:00 Wilhelm Burger [email protected]:

Did another test with an older OpenCV version (1.1), using the following dependency in my POM:

org.bytedeco javacv 1.1

I manualy copied the associated Maven artefacts to Image/jars:

  • javacpp-1.1.jar
  • javacv-1.1.jar
  • opencv-3.0.0-1.1.jar
  • opencv-3.0.0-1.1-windows-x86_64.jar

With this setup everything works nicely, compile-and-run does not hang.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joheras/IJ-OpenCV/issues/1#issuecomment-274346827, or mute the thread https://github.com/notifications/unsubscribe-auth/AFMQGyIZlC0RiGizP-B5qwJc_zMnmDj2ks5rU5hogaJpZM4LqcTC .

joheras avatar Jan 23 '17 10:01 joheras

@imagingbook Does the newest version of javacv also have problems in IDEs such as Eclipse?

ctrueden avatar Mar 14 '17 14:03 ctrueden

Just did a quick test with the latest version (javacv 1.3.2) but could not get it to work. It appears to be a runtime problem unrelated to the IDE (Eclipse in my case).

imagingbook avatar Mar 14 '17 21:03 imagingbook