次のコードを使用して、XCode 4.4 (Mountain Lion) で png ファイルを開こうとしています (jpg ファイルで機能します)。
Mat image = imread( "/Users/user_name/Desktop/result.png" );
imshow( "", image );
waitKey( 0 );
しかし、OpenCV は次のエラーをスローします。
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
私のpngファイルは新しいlibpngを使用して作成されたようですが、OpenCVは古いものを使用しています。では、この問題を解決するにはどうすればよいですか?
編集:詳細
XCode 4.4 で OSX Mountain Lion を使用しており、MacPorts を使用してインストールされた OpenCV 2.4.2 を使用しています。