Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Build with opencv ?

Explorer ,
Dec 07, 2018 Dec 07, 2018

Hi all !

Trying to experiment with opencv. it's working fine but I can't succeed to compile it with the static libraries, it's still requiring the dylib files, which is not very useful for distribution. Can't find the answer on the interwebs   (I'm on Mac BTW. Haven't tried on Windows yet)

So I'm wondering if anyone here knows how to either:

A- Compile a plugin with opencv embeded in it (no need for the opencv dynamic libs)

or

B- How do you properly distribute a plugin that needs external libs ?

Thanks !

Gab

TOPICS
SDK
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Dec 07, 2018 Dec 07, 2018

Hi Gab,

yes, it should be possible to compile and link the static OpenCV libraries, but it is quite a bit of work. You need to set several build switches (I think one of them was "NO_SHARED_LIBS", have all the needed internal helper libraries (png, tiff, etc.) also as static libs, etc.), but you should be able to make OpenCV libs that can be statically linked. Last time I tried it, it took me about a day to set all things up properly though, and I doubt things have changed much.

Apple discourages

...
Translate
Community Expert ,
Dec 07, 2018 Dec 07, 2018

errr... that's a mommy question... Toby (reduxFX)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2018 Dec 07, 2018

meaning ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2018 Dec 07, 2018

toby is knows WAY more about these issues than me.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 07, 2018 Dec 07, 2018

Hi Gab,

yes, it should be possible to compile and link the static OpenCV libraries, but it is quite a bit of work. You need to set several build switches (I think one of them was "NO_SHARED_LIBS", have all the needed internal helper libraries (png, tiff, etc.) also as static libs, etc.), but you should be able to make OpenCV libs that can be statically linked. Last time I tried it, it took me about a day to set all things up properly though, and I doubt things have changed much.

Apple discourages the usage of statically linked libraries, but if you want to go the route with external/dynamic libs, it won't get that much easier, as you probably found out. The libs need to be placed in the correct lib folders so that the plugin/program can see them, but problems might arise if there are other versions of these libs are present on the user's system. Placing the files next to the actual plugin in the AE folder also did not work, if I remember correctly.

So, unfortunately no clear recommendation from my side, as for both approaches you will need time and nerves

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2018 Dec 07, 2018

Haha ok !

Thanks for your answer... so it confirms what i've been through in the last days/weeks.

already tried eveything I could with building opencv (SHARED_LIBS off and etc) .

In parallel, i've also started to code my plugin in native C/C++ instead of relying on opencv ... might actually be faster

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 10, 2018 Dec 10, 2018
LATEST

For the record, it is actually possible. I managed to build static libs on MacOS for OpenCV 3.4.4 and also the brand-new OpenCV 4.0.0. Compilation is a bit tricky, as you have to find the right makefile parameters, especially since by default it comes with most of them set to active which might lead to problem since that requires for example the various neuronal network libraries to be already installed. Reducing it down to a basic feature set and then building it works.

Linking these static libraries in an Xcode project should be an easy task, but of course, it is not. Depending on your OS and compiler versions as well as a whole lot of dependencies, you might get a long list of weird error messages on compilation. Expect to spend a full afternoon with a sledgehammer to finally convince Xcode to cooperate, and then you are set.

If anyone has questions regarding this or needs help adapting OpenCV to a custom configuration, just drop me a line.

Cheers,

Toby / reduxFX

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines