显示图像时出现有限的GraphicsMagick错误

时间:2019-06-14 13:59:51

标签: image matlab octave

我正在尝试使用以下代码显示图像:

filename = 'testflower.png';
A = importdata(filename);
image(A);

但是,我遇到以下错误:

$ octave showimg.m 
warning: your version of GraphicsMagick limits images to 16 bits per pixel
warning: called from
    imformats>default_formats at line 256 column 11
    imformats at line 79 column 3
    imageIO at line 106 column 11
    imread at line 106 column 30
    importdata at line 110 column 50
    showimg.m at line 3 column 3
error: invalid value for array property "cdata"
error: called from
    image>__img__ at line 201 column 5
    image at line 119 column 10
    showimg.m at line 4 column 1

我正在Debian Stable Linux上使用Octave版本4.0.3-3。

问题出在哪里,如何解决?感谢您的帮助。

编辑:png的详细信息(由@MarkSetchell在评论中建议)如下:

$ pngcheck -v testflower.png 
File: testflower.png (17349 bytes)
  chunk IHDR at offset 0x0000c, length 13
    927 x 258 image, 8-bit palette, non-interlaced
  chunk PLTE at offset 0x00025, length 768: 256 palette entries
  chunk tRNS at offset 0x00331, length 217: 217 transparency entries
  chunk pHYs at offset 0x00416, length 9: 3780x3780 pixels/meter (96 dpi)
  chunk IDAT at offset 0x0042b, length 8192
    zlib: deflated, 32K window, default compression
  chunk IDAT at offset 0x02437, length 8058
  chunk IEND at offset 0x043bd, length 0
No errors detected in testflower.png (7 chunks, 92.7% compression).

1 个答案:

答案 0 :(得分:0)

您可以省去警告,因为16位see here

您看到的错误来自图像(不是importdata),显然是因为importdata的返回值与GNU Octave版本中的image不兼容(它与5.x兼容)< / p>

使用

img = imread ("test.png");
image (img)

代替