从两个文件夹中提取图像,并对图像进行做差,代码如下:
path1='C:\Users480\Desktop\matlab0522\bg\'; path2='C:\Users480\Desktop\matlab0522\ord\'; for i=1:15 %图像数量 I = imread([path2 'image' num2str(i) '.bmp']); J = imread([path1 'image_bg' num2str(i) '.bmp']); K = imabsdiff(I,J); imwrite(K,['C:\Users480\Desktop\matlab0522\dst\' 'image_obj' num2str(i) '.bmp']); endpath1='C:\Users