【发布时间】:2017-11-25 05:51:59
【问题描述】:
我有这个 matlab 代码来创建几个图像的平均值: cd('C:\images')
all_images=dir('*.jpg');
[sj,xx]=size(all_images);
j=1;
file_name=char(all_images(j).name);
tmp=imread(file_name);
[m,n]=size(tmp);
template=zeros(m,n);
for i=1:length(all_images)
file_name=char(all_images(i).name);
tmp=double(imread(file_name));
template=template+tmp;
end
template=template/length(all_images);
imagesc(template)
imwrite(uint8(template),'template.jpg','jpg')
情况是我得到以下错误:
错误
使用+矩阵尺寸必须一致。
错误
在平均模板中(第 15 行)模板=模板+tmp;
有什么想法吗?不得不说我是matlab编码的新手。
谢谢
【问题讨论】:
-
您确定您的文件包含相同大小的图像吗?这可能是你的问题。
-
是的,所有图像的大小都相同
标签: matlab