Unloaded module when linked to OpenCV

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

Unloaded module when linked to OpenCV

Kostro Daniel
Hi all,

I am trying to write a loadable module that uses OpenCV. I do a superbuild to build OpenCV and then link the OpenCV library to the module by adding ${OpenCV_LIBS} to the TARGET_LIBRARIES when slicerMacroBuildQtModule macro is called. It all works on Mac, but I need it to work on Windows though.

On Windows (7),  the compilation and linking is done without errors but Slicer does no load the module (even though the module's dll is in the right place and I have added the path). If I remove all opencv objects or function calls from my code then the module is correctly loaded again.

Does anybody have clue what can be going on? Also if anybody knows an already existing Slicer 4 module that works with opencv please let me know! Right now my cmake code is based on Laurent's module https://github.com/lchauvin/NeuroendoscopeDemo. I've put my code on github as well https://github.com/dkostro/SurfFeatures. The file where I instantiate a randomly taken OpenCV object is in this file, line 90: https://github.com/dkostro/SurfFeatures/blob/master/SurfFeatures/qSlicerSurfFeaturesModuleWidget.cxx
Commenting/uncommenting that line make the module loaded/notloaded

Thank you

--
Daniel

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: Unloaded module when linked to OpenCV

lasso

Do you use OpenCV for live image acquisition only, or also for image processing?

If you need only image acquisition then probably it’s simpler to use OpenIGTLink instead.

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Daniel Kostro
Sent: April 18, 2013 12:48 PM
To: [hidden email]
Subject: [slicer-devel] Unloaded module when linked to OpenCV

 

Hi all,

 

I am trying to write a loadable module that uses OpenCV. I do a superbuild to build OpenCV and then link the OpenCV library to the module by adding ${OpenCV_LIBS} to the TARGET_LIBRARIES when slicerMacroBuildQtModule macro is called. It all works on Mac, but I need it to work on Windows though.

 

On Windows (7),  the compilation and linking is done without errors but Slicer does no load the module (even though the module's dll is in the right place and I have added the path). If I remove all opencv objects or function calls from my code then the module is correctly loaded again.

 

Does anybody have clue what can be going on? Also if anybody knows an already existing Slicer 4 module that works with opencv please let me know! Right now my cmake code is based on Laurent's module https://github.com/lchauvin/NeuroendoscopeDemo. I've put my code on github as well https://github.com/dkostro/SurfFeatures. The file where I instantiate a randomly taken OpenCV object is in this file, line 90: https://github.com/dkostro/SurfFeatures/blob/master/SurfFeatures/qSlicerSurfFeaturesModuleWidget.cxx

Commenting/uncommenting that line make the module loaded/notloaded

 

Thank you

 

--

Daniel


_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: Unloaded module when linked to OpenCV

Kostro Daniel
I use it for image processing purposes...


On Thu, Apr 18, 2013 at 1:01 PM, Andras Lasso <[hidden email]> wrote:

Do you use OpenCV for live image acquisition only, or also for image processing?

If you need only image acquisition then probably it’s simpler to use OpenIGTLink instead.

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Daniel Kostro
Sent: April 18, 2013 12:48 PM
To: [hidden email]
Subject: [slicer-devel] Unloaded module when linked to OpenCV

 

Hi all,

 

I am trying to write a loadable module that uses OpenCV. I do a superbuild to build OpenCV and then link the OpenCV library to the module by adding ${OpenCV_LIBS} to the TARGET_LIBRARIES when slicerMacroBuildQtModule macro is called. It all works on Mac, but I need it to work on Windows though.

 

On Windows (7),  the compilation and linking is done without errors but Slicer does no load the module (even though the module's dll is in the right place and I have added the path). If I remove all opencv objects or function calls from my code then the module is correctly loaded again.

 

Does anybody have clue what can be going on? Also if anybody knows an already existing Slicer 4 module that works with opencv please let me know! Right now my cmake code is based on Laurent's module https://github.com/lchauvin/NeuroendoscopeDemo. I've put my code on github as well https://github.com/dkostro/SurfFeatures. The file where I instantiate a randomly taken OpenCV object is in this file, line 90: https://github.com/dkostro/SurfFeatures/blob/master/SurfFeatures/qSlicerSurfFeaturesModuleWidget.cxx

Commenting/uncommenting that line make the module loaded/notloaded

 

Thank you

 

--

Daniel




--
Daniel

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: Unloaded module when linked to OpenCV

Jean-Christophe Fillion-Robin
Hi Daniel, 

Nice work. 

It is probably because the path where OpenCV libraries are built are not considered by the launcher. When extension are installed using the extension manager, launcher setting are updated to consider Slicer modules location and also standard location like "/path/to/extension/{bin, lib/Slicer-4.2}" [1][2]. (Note that the value of these paths is abstracted using Slicer_BIN_DIR and Slicer_LIB_DIR). But when you manually add the module path through the settings ... launcher settings are not updated. This will be fixed as part of issue 2145 [3]

Since on linux and macosx there is rpath-like system, the opencv library are loaded but not on windows.
You could manually edit "/path/to/Slicer-Superbuild/Slicer-build/SlicerLauncherSettings.ini"


Hth
Jc







On Thu, Apr 18, 2013 at 1:52 PM, Daniel Kostro <[hidden email]> wrote:
I use it for image processing purposes...


On Thu, Apr 18, 2013 at 1:01 PM, Andras Lasso <[hidden email]> wrote:

Do you use OpenCV for live image acquisition only, or also for image processing?

If you need only image acquisition then probably it’s simpler to use OpenIGTLink instead.

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Daniel Kostro
Sent: April 18, 2013 12:48 PM
To: [hidden email]
Subject: [slicer-devel] Unloaded module when linked to OpenCV

 

Hi all,

 

I am trying to write a loadable module that uses OpenCV. I do a superbuild to build OpenCV and then link the OpenCV library to the module by adding ${OpenCV_LIBS} to the TARGET_LIBRARIES when slicerMacroBuildQtModule macro is called. It all works on Mac, but I need it to work on Windows though.

 

On Windows (7),  the compilation and linking is done without errors but Slicer does no load the module (even though the module's dll is in the right place and I have added the path). If I remove all opencv objects or function calls from my code then the module is correctly loaded again.

 

Does anybody have clue what can be going on? Also if anybody knows an already existing Slicer 4 module that works with opencv please let me know! Right now my cmake code is based on Laurent's module https://github.com/lchauvin/NeuroendoscopeDemo. I've put my code on github as well https://github.com/dkostro/SurfFeatures. The file where I instantiate a randomly taken OpenCV object is in this file, line 90: https://github.com/dkostro/SurfFeatures/blob/master/SurfFeatures/qSlicerSurfFeaturesModuleWidget.cxx

Commenting/uncommenting that line make the module loaded/notloaded

 

Thank you

 

--

Daniel




--
Daniel

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



--
+1 919 869 8849

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: Unloaded module when linked to OpenCV

Kostro Daniel
Hi Jc,

Thanks a lot for the comments and the fix suggestion, it worked!

--
Daniel


On Thu, Apr 18, 2013 at 4:38 PM, Jean-Christophe Fillion-Robin <[hidden email]> wrote:
Hi Daniel, 

Nice work. 

It is probably because the path where OpenCV libraries are built are not considered by the launcher. When extension are installed using the extension manager, launcher setting are updated to consider Slicer modules location and also standard location like "/path/to/extension/{bin, lib/Slicer-4.2}" [1][2]. (Note that the value of these paths is abstracted using Slicer_BIN_DIR and Slicer_LIB_DIR). But when you manually add the module path through the settings ... launcher settings are not updated. This will be fixed as part of issue 2145 [3]

Since on linux and macosx there is rpath-like system, the opencv library are loaded but not on windows.
You could manually edit "/path/to/Slicer-Superbuild/Slicer-build/SlicerLauncherSettings.ini"


Hth
Jc







On Thu, Apr 18, 2013 at 1:52 PM, Daniel Kostro <[hidden email]> wrote:
I use it for image processing purposes...


On Thu, Apr 18, 2013 at 1:01 PM, Andras Lasso <[hidden email]> wrote:

Do you use OpenCV for live image acquisition only, or also for image processing?

If you need only image acquisition then probably it’s simpler to use OpenIGTLink instead.

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Daniel Kostro
Sent: April 18, 2013 12:48 PM
To: [hidden email]
Subject: [slicer-devel] Unloaded module when linked to OpenCV

 

Hi all,

 

I am trying to write a loadable module that uses OpenCV. I do a superbuild to build OpenCV and then link the OpenCV library to the module by adding ${OpenCV_LIBS} to the TARGET_LIBRARIES when slicerMacroBuildQtModule macro is called. It all works on Mac, but I need it to work on Windows though.

 

On Windows (7),  the compilation and linking is done without errors but Slicer does no load the module (even though the module's dll is in the right place and I have added the path). If I remove all opencv objects or function calls from my code then the module is correctly loaded again.

 

Does anybody have clue what can be going on? Also if anybody knows an already existing Slicer 4 module that works with opencv please let me know! Right now my cmake code is based on Laurent's module https://github.com/lchauvin/NeuroendoscopeDemo. I've put my code on github as well https://github.com/dkostro/SurfFeatures. The file where I instantiate a randomly taken OpenCV object is in this file, line 90: https://github.com/dkostro/SurfFeatures/blob/master/SurfFeatures/qSlicerSurfFeaturesModuleWidget.cxx

Commenting/uncommenting that line make the module loaded/notloaded

 

Thank you

 

--

Daniel




--
Daniel

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



--
<a href="tel:%2B1%20919%20869%208849" value="+19198698849" target="_blank">+1 919 869 8849



--
Daniel

_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject