openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.91k stars 2.55k forks source link

ofxOpenCv missing libpng, libjpeg, libtiff #3678

Open nneonneo opened 9 years ago

nneonneo commented 9 years ago

Attempting to call cvSaveImage/cvLoadImage from highgui.h results in linker errors on Windows (possibly other platforms) because the OpenCV libs are missing libpng, libjpeg and libtiff.

This issue was discovered while trying to compile ofxFerns on Windows, because the FERNS code uses these two functions.

The simplest fix would probably be to include precompiled versions of these libs with the OpenCV libs.

nneonneo commented 9 years ago

For example, when building OpenCV, these libraries are included in the output directory:

opencv_libs

If we included these libraries in ofxOpenCv, the problem would disappear.

arturoc commented 9 years ago

the problem with including this libraries is that we are already including libpng through cairo and all of them thorugh freeimage so including them again with opencv produces some clashes when compiling applications that use for example opencv and ofImage. there should be a way of making freeimage publish those symbols so opencv functions can use them too, but not sure if it's possible

nneonneo commented 9 years ago

On MSVC at least, I compiled ofxFern with these libraries added to ofxOpenCv, and included some ofImage.loadImage calls. No linker errors were seen.

On other platforms, I am not sure if this problem exists.

DomAmato commented 9 years ago

My concern is that if we do this and it does clash on other systems it means recompiling libs and also bloats the size with redundant libraries (I think there are like 3 zlib.libs currently already). Does this require a recompile of the openCV libs or just the inclusion of those libraries because if it is the latter I think it would be better to have those libraries included with the addon rather than the core addon.