forked from jiayunz/Virtual-Try-On
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_data.m
More file actions
20 lines (16 loc) · 726 Bytes
/
convert_data.m
File metadata and controls
20 lines (16 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function data=convert_data(source_root_dir, target_root_dir, imname, cname, fine_height, fine_width)
% generate image
im = imread([source_root_dir 'image/' imname]);
im = imresize(im, [fine_height, fine_width], 'bilinear');
imwrite(im, [target_root_dir 'image/' imname]);
% generate cloth mask
im_c = imread([source_root_dir 'cloth/' cname]);
im_c = imresize(im_c, [fine_height, fine_width], 'bilinear');
imwrite(im_c, [target_root_dir 'cloth/' cname]);
% save cloth mask
mask = double((im_c(:,:,1) <= 250) & (im_c(:,:,2) <= 250) & (im_c(:,:,3) <= 250));
mask = imfill(mask);
mask = medfilt2(mask);
imwrite(mask, [target_root_dir 'cloth-mask/' cname]);
data = 0
end