Libpng在OpenCV上发生冲突? [英] Libpng conflict on OpenCV?

查看:172
本文介绍了Libpng在OpenCV上发生冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码在XCode 4.4(Mountain Lion)上打开png文件(适用于jpg文件)

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 );

但是OpenCV抛出此错误:

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

似乎我的png文件是使用较新的libpng创建的,而OpenCV使用的是较旧的libpng.那我该如何解决这个问题呢?

Seems like my png file was created using a newer libpng, while OpenCV is using older one. So how do I resolve this issue ?

更多信息

我正在使用OSX Mountain Lion,XCode 4.4,以及通过MacPorts安装的OpenCV 2.4.2.

I'm using OSX Mountain Lion, with XCode 4.4, and using OpenCV 2.4.2 installed by using MacPorts

推荐答案

否. png文件不是问题.创建哪个版本都没有关系.它将兼容.问题出在您的libpng库中.

No. It is not an issue with your png file. it does not matter what version it was created with. It will be compatible. The issue is in your libpng library.

使用libpng-1.4.12构建的应用程序-这意味着您的可执行文件已链接到libpng 1.4.12.

Application built with libpng-1.4.12 - This means that your executable was linked to libpng 1.4.12.

但使用1.5.4 运行-这意味着在运行时,您的可执行文件将选择该库的1.5.4版本(也许是动态库).

but running with 1.5.4 - this means that during run time, your executable is picking up version 1.5.4 of the library( a dynamic library perhaps).

OpenCV 2.4.2随libpng一起提供-1.5.9-这里似乎不匹配.

OpenCV 2.4.2 ships with libpng - 1.5.9 - there seems to be a mismatch here.

无论如何,要解决此问题,请确保在链接期间,您链接到使用OpenCV构建的libpng.如果要动态链接,请确保您的库路径在所有其他路径之前都包含OpenCV的第三方lib路径.

Anyway, to fix this, ensure that during linking, you link with the libpng built with OpenCV. If you are linking dynamically, ensure that your librarypath includes OpenCV's 3rd party lib path ahead of all others.

这篇关于Libpng在OpenCV上发生冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆