0
据我所知,类似的问题之前已经被问过,但我已经尝试了其他的解决方案,没有运气。真的很感谢一些帮助!将图像存储到matlab中的单元格
我想1.加载一个图像文件,2.用imread读取它们,3.输入一个单元格,4.在单元格中的每个数组上逐步运行我的函数。
这里是我的1个图像/文件
function sym_file(filename) %this calls for the image file name
j=im2double(rgb2gray(imread(filename)));
%reads the image, turns int into grayscale and double
if rem(size(j,2),2)~=0,j(:,1)=[];
if rem(size(j,1),2)~=0,j(1,:)=[];
end
end
%this made sure the rows and columns are even
jr=fliplr(j);
left=(j(:,1:size(j,2)/2));
right=(jr(:,1:size(j,2)/2));
t=sum(left,2);
u=sum(right,2);
symmetry= (left-right)./255;
symmetry2=reshape(symmetry,1,(numel(symmetry)));
imbalance=mean(symmetry2)
asymmetry=sqrt(mean(symmetry2.^2))
%runs calculations on image
figure('Name',num2str(filename),'NumberTitle','off')
subplot(3,2,1)
histogram(symmetry2,200)
title(['symmetry:' num2str(asymmetry)])
subplot(3,2,2)
imshow(j)
title(['imbalance:' num2str(imbalance)])
subplot(3,2,3)
imshow(left)
title('left')
subplot(3,2,4)
imshow(fliplr(right))
title('right')
impixelinfo;
subplot(3,2,5)
plot(1:length(t),t,'-r',1:length(u),u,'-b')
title('results,red=left/blue=right')
%printing results in a figure
功能,所以我想与图像的文件要做到这一点,而不是做它通过的文件中。最好的方法是什么?另外,如果有人知道如何将数据/数据存储在文件中,那也是一种奖励。
是的,但是如何将它们存储在单元格中? –
在这个例子中,我只是做一些事情:八度:4> my_cell {1} = x –
抱歉,我认为你误解了这个问题。我在问我如何将IMAGES放入单元格?你假设我已经将它们存储在一个单元中,但这正是我需要帮助的。谢谢! –