Feedback on OpenCV-to-ImageJ Plugin needed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Feedback on OpenCV-to-ImageJ Plugin needed

Jan-2
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
Reply | Threaded
Open this post in threaded view
|

Re: Feedback on OpenCV-to-ImageJ Plugin needed

ctrueden
Hi Jan,

> I am working on a plugin to extend ImageJ with OpenCV functionality.

Great stuff. Some quick comments:

1) You might be interested in these projects:

* https://github.com/scifio/scifio-javacv
* https://github.com/knime-ip/knip-opencv

Neither of those replicates exactly what you are trying to do, but thought
you might be interested to know.

2) I suggest you provide an ImageJ update site (
http://imagej.net/Update_Sites) to ease installation for users.
See also: http://imagej.net/Distribution

3) I suggest you build your functionality on SciJava/ImageJ2. For example,
you have converters which go between ImageJ and OpenCV data structures. You
could do that using SciJava converters, and then everyone could seamlessly
annotate those types in their scripts in all supported scripting languages.
Here are some examples that do this for MATLAB matrices <-> ImageJ2
datasets:

*
https://github.com/imagej/imagej-matlab/blob/imagej-matlab-0.7.1/src/main/java/net/imagej/matlab/DatasetMATLABConverter.java
*
https://github.com/imagej/imagej-matlab/blob/imagej-matlab-0.7.1/src/main/java/net/imagej/matlab/MATLABDatasetConverter.java
*
https://github.com/imagej/imagej-matlab/blob/imagej-matlab-0.7.1/src/main/java/net/imagej/matlab/DefaultImageJMATLABService.java#L77-L196

See also:
http://imagej.net/MATLAB_Scripting

4) I suggest you build your component with Maven, so that it is easier for
others to consume and build upon it.

Thanks for your work bridging these two excellent worlds!

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Tue, Jun 28, 2016 at 3:47 PM, Jan <[hidden email]> wrote:

> 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
Reply | Threaded
Open this post in threaded view
|

Re: Feedback on OpenCV-to-ImageJ Plugin needed

Burger Wilhelm
In reply to this post by Jan-2
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
Reply | Threaded
Open this post in threaded view
|

Re: Feedback on OpenCV-to-ImageJ Plugin needed

Jan-2
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
Reply | Threaded
Open this post in threaded view
|

Re: Feedback on OpenCV-to-ImageJ Plugin needed

Burger Wilhelm
Hi Jan,

Ad 1) I agree, the "official" wrapper is probably the best way to go. Unfortunately there is currently no Maven support (or at least I don't know of), unlike for the other two options.

Note that in any more complex application you definitely want to bind the OpenCV API directly (instead of using reflection), thus a stable API seems essential.

Ad 2) I actually succeeded in solving the dynamic class loading problem under ImageJ1, using a small proxy class for loading the DLLs and enforcing the use of a particular class loader. If interested, you find the details in this preliminary project: https://bitbucket.org/digitalimaging/imagingbook-opencv-nonmaven (Windows only).

I'd love to see a simple and dependable bridge between IJ and OpenCV.
Same for OpenGL and PCL ...

Thanks,
Wilhelm



-----Original Message-----
From: Jan [mailto:[hidden email]]
Sent: Mittwoch, 29. Juni 2016 21:55
To: [hidden email]
Cc: Burger Wilhelm <[hidden email]>
Subject: Re: Feedback on OpenCV-to-ImageJ Plugin needed

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