Ask Your Question

libpng issues ?

asked 2012-08-08 08:14:38 -0500

sub_o gravatar image

updated 2012-08-08 08:26:15 -0500

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

edit retag flag offensive close merge delete


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 gravatar imagesammy ( 2012-08-08 08:34:05 -0500 )edit

@sammy Do you have any idea how to do this ? I am quite new when it comes to compiling my own libraries.

sub_o gravatar imagesub_o ( 2012-08-08 08:55:51 -0500 )edit

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

sammy gravatar imagesammy ( 2012-08-08 09:19:20 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-21 19:33:05 -0500

xzp777 gravatar image

maybe a simple way is to uninstall opencv and libpng, then install opencv again

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-08-08 08:14:38 -0500

Seen: 1,077 times

Last updated: Oct 21 '15