Posted by
Jan-2 on
Jun 29, 2016; 7:54pm
URL: http://imagej.273.s1.nabble.com/Feedback-on-OpenCV-to-ImageJ-Plugin-needed-tp5016747p5016774.html
Thanks for the quick response!
1) Since the guys behind OpenCV bundle precompiled jars and native libs
with the new OpenCV releases, it seems safe to stick to their releases.
Big advantage is that this makes the plugin uses reflections and is thus
agnostic of the OpenCV version. Only the converters are at risk, if e.g.
the Mat class changes, but with almost the entire rest of the OpenCV lib
relying on these classes, this is unlikely to happen.
2) Classloading is the big bugbear of this problem and the reason why
there is no full release yet. Even though I managed to switch jars at
runtime, I have not figured out yet how to force Java into reloading
specific jars or entire archives (the lazy behavior of Java's
classloader is a pain). This is also the reason why ImageJ needs to be
restarted after installing an OpenCV jar from inside the plugin.
Interestingly, ImageJ and Fiji handle things differently; OpenCV jars
are loaded improperly in ImageJ, while Fiji loads and executes
everything correctly. Changing class paths and/or hijacking ImageJ's
classloader has (for now) proven unsuccessful. I am still investigating
and probably have to temper with the JVM classloaders to resolve this issue.
3) Platform independence is one of the core goals, x86 and x64
architectures are already supported. At first glance, it should not
involve too much of work to run the plugin on Linux, as this depends on
loading the correct native library. Debugging could be a different story
though ;)
Once it runs on Linux, I will target MacOS. Using the plugin on these
platforms might be a pain though because the OpenCV website only provide
precompiled jars and libs for Windows. Linux users have to build OpenCV
themselves.
I hope that addresses all points. I have been taking a break lately but
will get back to development soon.
Cheers,
Jan
On 29.06.2016 09:57, Burger Wilhelm wrote:
> Hello Jan,
>
> nice job! I too have been fiddling with OpenCV integration into ImageJ for a while now, so here are a few thoughts:
>
> 1) I am aware of at least three different Java bindings/wrappers for OpenCV, all with different APIs:
> - the official OpenCV-Java release (
http://opencv.org/opencv-java-api.html),
> - the OpenCV 3.0 Java book API (
https://github.com/JavaOpenCVBook/),
> - JavaCPP/JavaCV (
https://github.com/bytedeco/javacv).
> Only JavaCV (which you are using) seems to support the latest (3.1) version of OpenCV. Since it appears that version 2.4 is still being developed in parallel, I wonder which route is safe in the long run.
>
> 2) When using native libraries in Java, class loading can be a painful issue. Things are easy if the application just launches and runs once, but different when, e.g., performing 'compile-and-run' on ImageJ plugins, since this causes the associated classes to be (re)loaded dynamically. Did you check if your setup handles this situation?
>
> 3) From my point of view, platform independence is probably THE most important reason for using ImageJ. Do you think it possible to create a single, flexible OpenCV setup for multiple platforms?
>
> --Wilhelm
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Jan
> Sent: Dienstag, 28. Juni 2016 22:48
> To:
[hidden email]
> Subject: Feedback on OpenCV-to-ImageJ Plugin needed
>
> Hi,
> I am working on a plugin to extend ImageJ with OpenCV functionality.
> You can watch a demo video on YouTube to get a first impression:
>
https://youtu.be/irnBuvW2dEo> Code and jars have been uploaded to GitHub:
>
https://github.com/m4dguy/CVForge> It still needs polish, so any suggestions and are feedback is greatly appreciated.
> Cheers,
> Jan
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html