0

让我先说我爱你。谢谢你。

下一个业务顺序:

octave-3.2.3:8> xin = imread('3Phone.png');
octave-3.2.3:9> colormap(gray(256));
octave-3.2.3:10> image(xin);
error: invalid value for array property "cdata"
error: set: expecting argument 2 to be a property name
error: set: expecting argument 4 to be a property name
error: set: expecting argument 6 to be a property name
error: called from:
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/image/__img__.m at line 57, column 7
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/image/image.m at line 75, column 5
error: A(I): Index exceeds matrix dimension.
error: called from:
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/plot/__go_draw_axes__.m at line 383, column 22
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/plot/__go_draw_figure__.m at line 92, column 3
error:   /Applications/Octave.app/Contents/Resources/share/octave/3.2.3/m/plot/gnuplot_drawnow.m at line 91, column 5
octave-3.2.3:10> 

我在 Mac OS X (Snow Leopard) 上使用 Octave 3.2.3。这是显示已读取并存储在内存中的图像的非常基本的尝试。任何有关解决此问题的帮助将不胜感激。谢谢!

4

1 回答 1

1

我的猜测,当您阅读 png 文件时 - 确保它是灰度文件。否则有 3 个矩阵 (RGB)。因此,您不能使用灰色颜色图。

如果 2Phone.png 是彩色图像,请尝试(至少这是我在 Matlab 中会做的):

xin = imread('3Phone.png');
image(xin(:, :, 1);
colormap(gray(256));

这将仅显示 R 矩阵。

或者更好的是,使用RGB2Gray(当然,使用相当于 Octave 的)。

于 2009-12-29T10:08:13.483 回答