incorporating opencv as a 3rdparty lib for plugin writters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

incorporating opencv as a 3rdparty lib for plugin writters

Vikram Kopuri
Hi All, 

I've been working on a micro-manager 1.4 plugin for tracking a feature in XY and Z. It heavily relies OpenCV 2.4 libraries for the task. Opencv  has a nice collection of efficient and easy to use libraries  for image processing , motion tracking and even machine learning. I admit there is some overlap with imagej libraries. It would still make a great addition to micro manager. 

Could the powers be consider incorporating opencv as a 3rd party library into micro manager (if not 1.4 atleast into 2.0) . 

Thanks

Vikram Kopuri
Electronics Engineer | Applied Scientific Instrumentation





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: incorporating opencv as a 3rdparty lib for plugin writters

Mark Tsuchida-3
Hi Vik,

On Wed, Jul 18, 2018 at 11:38 AM, Vikram G Kopuri <[hidden email]> wrote:
I've been working on a micro-manager 1.4 plugin for tracking a feature in XY and Z. It heavily relies OpenCV 2.4 libraries for the task. Opencv  has a nice collection of efficient and easy to use libraries  for image processing , motion tracking and even machine learning. I admit there is some overlap with imagej libraries. It would still make a great addition to micro manager. 

Could the powers be consider incorporating opencv as a 3rd party library into micro manager (if not 1.4 atleast into 2.0) .

In general I would consider it a good thing if µManager could take advantage of OpenCV algorithms, but I also have the usual reservations about adding a major dependency.

Do you mean a Java plugin? Are you accessing OpenCV through its own Java wrappers, or javacv?

In either case, I think it would be easier for me to answer this question if I had a better idea of what this will involve, in terms of build complexity, installer size, and coordination with other existing uses of OpenCV in µManager (OpenCVgrabber) -- on Windows, Mac, and Linux. (Having multiple copies of OpenCV might be easy on Windows but I'm not so sure about Mac and Linux.)

If (1) the benefits outweigh any such concerns and (2) OpenCV is being used for something that cannot be easily accomplished using the ImageJ2/ImgLib2 ecosystem or some other stable, widely used Java libraries, then yes!

There is also the question of whether µManager should directly call OpenCV, or if it would be better to build a bridge from ImageJ to OpenCV and utilize that from µManager. (Would it not be ideal for a tracking plugin to work in both ImageJ and µManager, rather than just from µManager?) There is IJ-OpenCV but I hear it uses ImageJ1 data (i.e. not ImageJ2/ImgLib2), so it's not clear to me what the best course of action is at this moment.

Best,
Mark

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: incorporating opencv as a 3rdparty lib for plugin writters

Vikram Kopuri
Hey Mark, 

Thanks for getting back  on this. 

Yeah accessing OpenCV thru a java plugin. I noticed that MicroManager does come with some opencv dlls , they are probably accessible thru C++ , and probably for the OpenCVgrabber device adapter (which is great and works for unsupported camera in a pinch).  I actually use opencv 2.4.11 , its close to 2.4.8 which is what the opencvgrabber use. I could probably drop down to that version without issue. Atm of the 8 or so main API , only two OpenCVs main API are included (core and highgui). 

I use the OpenCV's own java wrapper. I couldn't see the advantage of one(OpenCV and JavaCV) over the other, mostly went with opencv itself because of better documentation. Also JavaCV needs JRE 7 and above, while MicroManager 1.4 runs on JRE 6 right ?

Right now, I have the user copy the opencv jar and dlls into micro-manager's plugin folder, and I use "java.lang.Runtime.getRuntime().load(name.dll)" to load the dll. So apart from the jar , it needs the dlls too. Which isn't as easy as including jfreechart or gson I guess which are native java. 

I briefly look at  ImageJ2/ImgLib2 . There is some overlap, but for motion tracking and machine learning opencv really shines, and it has a nice assortment of routines for that. 






~~~~~~~~~~~~~~~~~~~~~~
Vikram G Kopuri



On Thu, Jul 19, 2018 at 4:32 PM Mark Tsuchida <[hidden email]> wrote:
Hi Vik,

On Wed, Jul 18, 2018 at 11:38 AM, Vikram G Kopuri <[hidden email]> wrote:
I've been working on a micro-manager 1.4 plugin for tracking a feature in XY and Z. It heavily relies OpenCV 2.4 libraries for the task. Opencv  has a nice collection of efficient and easy to use libraries  for image processing , motion tracking and even machine learning. I admit there is some overlap with imagej libraries. It would still make a great addition to micro manager. 

Could the powers be consider incorporating opencv as a 3rd party library into micro manager (if not 1.4 atleast into 2.0) .

In general I would consider it a good thing if µManager could take advantage of OpenCV algorithms, but I also have the usual reservations about adding a major dependency.

Do you mean a Java plugin? Are you accessing OpenCV through its own Java wrappers, or javacv?

In either case, I think it would be easier for me to answer this question if I had a better idea of what this will involve, in terms of build complexity, installer size, and coordination with other existing uses of OpenCV in µManager (OpenCVgrabber) -- on Windows, Mac, and Linux. (Having multiple copies of OpenCV might be easy on Windows but I'm not so sure about Mac and Linux.)

If (1) the benefits outweigh any such concerns and (2) OpenCV is being used for something that cannot be easily accomplished using the ImageJ2/ImgLib2 ecosystem or some other stable, widely used Java libraries, then yes!

There is also the question of whether µManager should directly call OpenCV, or if it would be better to build a bridge from ImageJ to OpenCV and utilize that from µManager. (Would it not be ideal for a tracking plugin to work in both ImageJ and µManager, rather than just from µManager?) There is IJ-OpenCV but I hear it uses ImageJ1 data (i.e. not ImageJ2/ImgLib2), so it's not clear to me what the best course of action is at this moment.

Best,
Mark
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: incorporating opencv as a 3rdparty lib for plugin writters

Mark Tsuchida-3
Hi Vik,

On Fri, Jul 20, 2018 at 4:19 PM, Vikram G Kopuri <[hidden email]> wrote:
Yeah accessing OpenCV thru a java plugin. I noticed that MicroManager does come with some opencv dlls , they are probably accessible thru C++ , and probably for the OpenCVgrabber device adapter (which is great and works for unsupported camera in a pinch).  I actually use opencv 2.4.11 , its close to 2.4.8 which is what the opencvgrabber use. I could probably drop down to that version without issue. Atm of the 8 or so main API , only two OpenCVs main API are included (core and highgui).

Is there a reason not to use OpenCV 3.x?

I think OpenCVgrabber needs the highgui DLL because that's what contains the video capture library. Presumably any use from Java would NOT require highgui but rather core and a carefully chosen set of the actual algorithm modules.

Including all of OpenCV seems out of the question (it looks like it's bigger than µManager itself).

I use the OpenCV's own java wrapper. I couldn't see the advantage of one(OpenCV and JavaCV) over the other, mostly went with opencv itself because of better documentation. Also JavaCV needs JRE 7 and above, while MicroManager 1.4 runs on JRE 6 right ?

This is probably reasonable as javacv seems to have a much bigger scope than just OpenCV.

Right now, I have the user copy the opencv jar and dlls into micro-manager's plugin folder, and I use "java.lang.Runtime.getRuntime().load(name.dll)" to load the dll. So apart from the jar , it needs the dlls too. Which isn't as easy as including jfreechart or gson I guess which are native java.

Yes, including a C/C++ library of any sort usually involves nontrivial effort in the build system.
 
I briefly look at  ImageJ2/ImgLib2 . There is some overlap, but for motion tracking and machine learning opencv really shines, and it has a nice assortment of routines for that.

I didn't mean that the computer vision algorithms in OpenCV are available in ImageJ2 or that we should replicate them using ImgLib2. Rather, I meant that it would only make sense to depend on OpenCV if such algorithms are actually being used (I'm sure you are, but you didn't give any details...). And also that it might make more sense to craft a mechanism for easy access of OpenCV from ImageJ2, and then bridge from µManager to ImageJ2. (If adding OpenCV to µManager were a trivial matter, I wouldn't have brought this up.)

Again, this is not to say that I'm opposed to adding one or two of OpenCV's DLLs required by a plugin. But I don't think there is any reasonable way in which we can "make OpenCV available" in µManager in general. Even if we ship parts of OpenCV with µManager, it will be "plugin X depends on µManager and OpenCV", not "plugin X depends on µManager, which in turn includes OpenCV in its API". (This is the same with any other third party library, even though the current build system doesn't always reflect it; it will in the near future.)

Best,
Mark


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general