%批量把文件夹中的mask 转换为 轮廓
clear,clc
Original_image_dir = 'C:\Users\11549\Desktop\Object_Contour_Encoder-Decode\tensorflow-object-contour-detection-master\spliced_NIST\masks\';
fpath = fullfile(Original_image_dir, '*.png');
im_dir = dir(fpath);
im_num = length(im_dir);
for i=1:im_num
str1=im_dir(i).name;
I =imread(fullfile(Original_image_dir, im_dir(i).name));
contour = bwperim(~I,4);
B6=ones(5,5);
Z1=imerode(~contour,B6);
str3= ['C:\Users\11549\Desktop\Object_Contour_Encoder-Decode\tensorflow-object-contour-detection-master\spliced_NIST\groundtruth\',str1];
imwrite(double(~Z1), str3);
end