【问题标题】:imread() stopped working on Octaveimread() 停止在 Octave 上工作
【发布时间】:2014-01-06 18:18:32
【问题描述】:

我试过用谷歌搜索它,似乎没有其他人遇到过这种错误。

我在 Ubuntu 12.04 上使用 Octave 3.6.1。我一直在使用 imread() 函数读取图像很长一段时间,但就在昨天它开始抛出这个错误:

octave:5> I = imread('example.jpg');
error: imread: invalid image file: Magick++ exception: Magick: Unable to open file (tures/example.jpg) reported by coders/jpeg.c:955 (ReadJPEGImage)
error: called from:
error:   /usr/share/octave/3.6.1/m/image/imread.m at line 74, column 7

如果我尝试读取 PNG,我会收到类似的错误:

octave:5> I = imread('example.png');
error: imread: invalid image file: Magick++ exception: Magick: Unable to open file (tures/example.png) reported by coders/png.c:2790 (ReadPNGImage)
error: called from:
error:   /usr/share/octave/3.6.1/m/image/imread.m at line 74, column 7

有人知道发生了什么吗?如何解决这个问题?

非常感谢!

【问题讨论】:

  • 您是否尝试过重新安装您正在使用的图像处理包或 octave?安装后是否开始出现此错误?
  • 我尝试重新安装所有内容,但问题仍然存在。我相信它可能是在 Ubuntu 的每日更新之一之后开始的......
  • 并且example.jpg等肯定在正确的文件夹中吗?你的脚本的路径和图片的路径是什么?

标签: image octave graphicsmagick


【解决方案1】:

我在Windows 8.1 上遇到了与3.6.4 相同的问题,对我来说简单的解决方法是:

IMAGE_PATH = ('C:\Users\...'); 

图像的存储位置

Image = file_in_path(IMAGE_PATH, 'image.jpg');

当然,修复实际功能会更好,但现在已经足够了。

希望这会有所帮助。

【讨论】:

    【解决方案2】:

    Octave 使用 GraphicsMagick(或 ImageMagick)来处理图像的读取和写入。 GraphicsMagick 不直接处理图像的读取和写入,它是一个 API 下的许多格式库的包装器。

    当您构建 GraphicsMagick 时,它会检查您的系统是否有可用的库并禁用/激活现有格式。您可能在没有开发库 libpng 和 libjpeg 的情况下自己构建了 GraphicsMagick。在 Ubuntu 中,我相信这些都在包 libpng12-devlibjpeg8-dev 中。使用系统附带的 GraphicsMagick 库,或者如果您需要自己构建,请参阅Octave wiki 中的说明。

    要确认这确实是您的问题,请运行 gm -version 并检查这些格式是否已激活。例如,我系统中的输出显示:

    Feature Support:
      Thread Safe              yes
      Large Files (> 32 bit)   yes
      Large Memory (> 32 bit)  no
      BZIP                     yes
      DPS                      no
      FlashPix                 no
      FreeType                 yes
      Ghostscript (Library)    no
      JBIG                     yes
      JPEG-2000                yes
      JPEG                     yes
      Little CMS               yes
      Loadable Modules         no
      OpenMP                   yes (201107)
      PNG                      yes
      TIFF                     yes
      TRIO                     no
      UMEM                     no
      WMF                      yes
      X11                      yes
      XML                      yes
      ZLIB                     yes
    

    【讨论】:

    • 当我运行 'gm -version' 时,似乎没有任何问题; png 和 jpeg 格式都被标记为受支持。我尝试重新安装 Octave、GraphicsMagick,像 wiki 一样自行构建,但问题仍然存在。
    • @user3166406 仔细检查您的系统中是否有多个 GraphicsMagick。或者您拥有多个版本的 Octave,并且您仍在运行之前的 Octave 构建(与“坏”GraphicsMagick 相关联的版本)。
    猜你喜欢
    • 2014-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-15
    • 2013-02-08
    • 2014-07-04
    • 2017-08-18
    相关资源
    最近更新 更多