2009-12-03 71 views
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> 

我使用八度3.2.3在Mac OS X(雪豹)。这是显示已经读取并存储内存的图像的非常基本的尝试。任何帮助解决这个问题将不胜感激。谢谢!

+2

再次尝试没有'colormap'调用。你有同样的错误吗? – Amro 2009-12-03 20:32:10

+0

请删除此内容并将其设为问题。这不需要成为一个社区维基。 – monksy 2009-12-28 00:59:12

回答

1

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

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

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

这将只显示R矩阵。

或更好的,使用RGB2Gray(当然,使用相当于八度)。