libpng issues ?
I am trying to open up png files on my XCode 4.4 (Mountain Lion) with the following codes (works for jpg files)
Mat image = imread( "/Users/user_name/Desktop/result.png" );
imshow( "", image );
waitKey( 0 );
But OpenCV throws me this error:
libpng warning: Application built with libpng-1.4.12 but running with 1.5.4
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_opencv/opencv/work/OpenCV-2.4.2/modules/core/src/array.cpp, line 2482
libc++abi.dylib: terminate called throwing an exception
Seems like my png file was created using a newer libpng, while OpenCV is using older one. So how do I resolve this issue ?
Edit: more information
I'm using OSX Mountain Lion, with XCode 4.4, and using OpenCV 2.4.2 installed by using MacPorts
It rather seems that OpenCV is compiled to use 1.4.12, but you have installed 1.5.4 on your system. You can downgrade the libpng installed on your system (and possibly open up all kinds of nasty effects) or update the libpng that comes with opencv. That is not easy, either. A third option may be (not sure if it works) to compile statically all OpenCV, so it will not use the system's libpng, but its own
@sammy Do you have any idea how to do this ? I am quite new when it comes to compiling my own libraries.
Sorry, no. I do not have enough experience on Mac and/or CMake. But I think you can learn how to do it by googling about compiling/linking libraries on Mac. Try a few simple examples, then learn how to tweak OpenCV. Note that you'll have greater chances finding general compiling info on the net, than just asking on the OpenCV forums