【发布时间】:2012-01-27 09:07:43
【问题描述】:
我有 70 张人脸图像,它们存储在一个名为 (sub1.mat) 的 .mat 文件中,大小为 8064*70 ,每个图像都存储在“sub.mat”的列向量中,现在我想将每一列转换为图像格式(灰色图像),下面是我写的代码,但它没有给我正确的图像,有人可以告诉我是什么问题吗?感谢您的帮助。(我所知道的关于图像的唯一信息是:图像的大小为 100*100)
load sub1 % a .mat format with the size of 8064*70
%the first image, size 8064*1
a=sub1(:,1) %each column is an image of an individual
%convert the column matrix to 100*100 image
b=imresize(a,[100 100]);
im=mat2gray(b)
imwrite(im,'im1.pgm');
【问题讨论】:
-
尝试查看不同阶段的图像以缩小故障位置。例如。 imagesc(b) 计算后的 b 或 imagesc(im)