Subtracting velues in cell

3 vues (au cours des 30 derniers jours)
kash
kash le 3 Oct 2012
I have a code
for xx = 1:length(dirlist(1))
x = imread([pathname, dirlist(xx).name]);
x=rgb2gray(x);
x=imresize(x,[256 256]);
C = mat2cell(x,[128 128],[128 128]);
end
for xx = 1:length(dirlist)
x = imread([pathname, dirlist(xx).name]);
x=rgb2gray(x);
x=imresize(x,[256 256]);
C1 = mat2cell(x,[128 128],[128 128]);
,,,,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
end
I want to subtract values in C and C1,in dirlist I have 50 Images..I have taken reference frame and subtracted with other frames ..after C1 ,i want to subtract C with C1,please help

Réponse acceptée

Matt J
Matt J le 3 Oct 2012
The best thing would be to subtract first and do MAT2CELL second:
for xx = 1:length(dirlist(1))
x = imread([pathname, dirlist(xx).name]);
x=rgb2gray(x);
C=imresize(x,[256 256]);
end
for xx = 1:length(dirlist)
x = imread([pathname, dirlist(xx).name]);
x=rgb2gray(x);
C1=imresize(x,[256 256]);
end
D=mat2cell(C-C1,[128,128],[128,128]);
Alternatively, you can use CELLFUN:
D=cellfun(@(a,b) a-b, C1, C2, 'uni',0);
  2 commentaires
kash
kash le 3 Oct 2012
MAth ur first results gives error ,secong works i.e cell fun,as i sais i have 50 images ,so i have to get 50 such values but i get only one,
please help
Matt J
Matt J le 3 Oct 2012
If it works for 1 image, then why not just repeat the procedure in a loop to do all 50.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by