Octave imread function

流过昼夜 提交于 2019-12-21 10:55:22

问题


I installed latest Octave on Ubuntu 14.04 machine. However, when I tried to run imread command, it showed the following error message:

octave:12> imread('newfile.png')
error: imread: invalid image file: /usr/lib/x86_64-linux-gnu/octave/3.8.1/oct/x86_64-pc-linux-gnu/__magick_read__.oct: failed to load: /usr/lib/x86_64-linux-gnu/octave/3.8.1/oct/x86_64-pc-linux-gnu/__magick_read__.oct: undefined symbol: _ZN6Magick5ColorC1Ehhh
error: called from:
error:   /usr/share/octave/3.8.1/m/image/private/__imread__.m at line 181, column 7
error:   /usr/share/octave/3.8.1/m/image/private/imageIO.m at line 66, column 26
error:   /usr/share/octave/3.8.1/m/image/imread.m at line 107, column 30

Can someone please suggest how to solve it?

Thanks!


回答1:


Following these steps worked for me [Author: Christoffer Cronström (hymyly)]:

Install the dev packages needed to build octave.

sudo apt-get build-dep octave

Get the official source package. Do this in a clean directory, because it will get polluted.

cd ~/some/suitable/directory
apt-get source octave

Build it. This took roughly an hour for me.

cd octave-3.8.2
dpkg-buildpackage

Either run it from the build directory:

./run-octave

...or most preferably install it over the official octave:

cd ..
sudo dpkg --install octave_3.8.2-4_amd64.deb

From: https://bugs.launchpad.net/ubuntu/+source/octave/+bug/1372202




回答2:


How did you instal Octave? The error suggests that you're missing GraphicsMagick C++ interface (package libgraphicsmagick++3) but

  • if you installed Octave from Ubuntu's package manager you should not have had this problem; * if you compiled it yourself, Octave should have disabled imread completely and you'd have a very different error message.

So my guess is that you build it yourself, either with:

  • your own build of GraphicsMagick++ which are not being loaded anymore, you may need to add their path to the dynamic linker load path (either on /etc/ld.so.conf.d./graphicsmagick or define LD_LIBRARY_PATH);

  • the libraries from the package manager which you have since accidentally removed (since you did not install Octave from the repositories, your package manager will not know that libgraphicsmagick++ is installed for a reason).

Either way, the solution is easy. Install Octave from Ubuntu's package manager. One of the main reasons package managers exist is to avoid this type of problems, i.e., missing dependencies.



来源:https://stackoverflow.com/questions/25046327/octave-imread-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!