How can I use OpenCV on iOS with my own JPEG / PNG libraries?

I am using OpenCV in an iOS project, but I am having problems because the framework has libpng and libjpeg, which also includes my project. This causes duplicate characters during linking.

I would like to point OpenCV to its own libjpeg / png copies, but I cannot find a way to make this work. I tried setting the variables BUILD_PNG and BUILD_JPEG to NO, but that had no effect, and setting WITH_JPEG and WITH_PNG to NO caused runtime API errors when I tried to write images for lack of support.

I also considered just pointing my project to the libjpeg / png OpenCV Framework headers, but they are not rendered through the framework. I could pull the source for the version into the framework and plot against those headers so the link matches, but yuck.

What is the correct way to use OpenCV on iOS in a project that also uses libpng and libjpeg?

+3


source to share


1 answer


I suggest you just use the OpenCV versions of these libraries. This will require you to uninstall your own versions and ensure you get copies of the correct-versions of libpng and libjpeg.

I just did this myself for libpng - I need to get the headers for version 1.5.12. Please note that for this version you need a file pnglibconf.h

which you can find in libpng

to download asscripts/pnglibconf.h.prebuilt



My application was using libpng 1.2.34 and required very minor changes to work with 1.5.12.

I also did the same for libjpeg

- I needed to get headers for version 9 (libjpeg9)

. Again, you need a file jconfig.h

and the easiest way is to just rename the associated one jconfig.txt

.

0


source







All Articles