Subtracting velues in cell
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Matt J
2012-10-3
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 个评论
Matt J
2012-10-3
If it works for 1 image, then why not just repeat the procedure in a loop to do all 50.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!