【发布时间】:2013-09-22 03:07:10
【问题描述】:
我想用一个二维数组来存储img1、img2的所有值以及img1和img2的比较值, 我想实现喜欢的算法:
% read in the images from a folder one by one:
somefolder = 'folder';
filelist = dir([somefolder '/*.jpg']);
s=numel(filelist);
C = cell(length(filelist), 1);
for k=1:s
C{k}=imread([somefolder filelist(k).name]);
end
%choose any of the two images to compare
for t=1:(s-1)
for r=(t+1):s
img1=C{r};
img2=C{t};
ssim_value[num][1]=img1; % first img
ssim_value[num][2]=img2; % second img
ssim_value[num][3]=mssim; % ssim value of these two images
end
end
所以,我使用的二维数组(ssim_value)有错误,初始化它的正确方法是什么,如何达到保存我要存储的值的目的。
谁能帮帮我。提前致谢。
【问题讨论】:
-
你有python背景吗?试试不带方括号的
ssim_value。尝试类似:ssim_value{num,1} -
谢谢,我试过你的方法,应该可以了,我需要加载整个文件夹的图片看看效果如何,tks。
-
使用
fullfile命令为文件/文件夹名称创建字符串:fullfile( somefolder, '*.jpg' )优于[somefolder '/*.jpg']。
标签: arrays matlab image-processing