【问题标题】:Octave: "load: failed to load matrix constant"八度:“加载:加载矩阵常量失败”
【发布时间】:2012-06-13 23:46:51
【问题描述】:

我想在 Octave / Matlab 中保存和加载一组图像。 in the FAQ 给出的一般说明似乎不适用于保存和加载(octave 3.2.4,Ubuntu 12.04)。

即使用bg_header_mwlogo_notag.jpg

images = cell(1, 1);
for i=1
    images{i} = imread('/tmp/bg_header_mwlogo_notag.jpg');
end
save images;
load images;

给予:

error: load: failed to load matrix constant
error: load: trouble reading ascii file `'
error: load: reading file 
error: load: cell array element had unexpected name
error: load: failed to load cell element
error: load: trouble reading ascii file `images'
error: load: reading file images

如何在一个文件中保存和加载多张图片?

【问题讨论】:

  • 我复制了你的测试,它没有给我任何问题。与您的设置相同。
  • @LucaGeretti:谢谢,我已将代码更改为应该始终提供错误消息的内容。

标签: image matlab save octave


【解决方案1】:

从文件加载矩阵的 ASCII 表示时出现一些问题。如果您更愿意发布

images{i} = double(imread('/tmp/bg_header_mwlogo_notag.jpg'));

它实际上存储了数值,这对于 Matlab 来说非常好。您可以轻松检查这两种表示是否相等。另一方面,从文件中加载这种数字版本的矩阵是成功的。

【讨论】:

  • 谢谢,效果很好。存储为双精度似乎会减慢保存和加载速度,但这可以修复错误消息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-09-21
  • 1970-01-01
  • 2020-03-03
  • 2012-11-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多