标签:cname atl height nova txt dir matlab src function
<script src="https://gist.github.com/novav/63a27bb4bb068be659f71dc9568aef84.js"></script>
% Windows function convert_data() source_root_dir = ‘E:/data/‘; %cname = ‘000003_1.jpg‘; target_root_dir = ‘E:/data/‘; fine_height = 256; fine_width = 192; mode = ‘train‘; [im_names, cloth_names] = textread([‘E:\data\train_pairs_ansi.txt‘],‘%s %s‘); N = length(im_names); for i = 1:N; imname = im_names{i} ; cname = cloth_names{i}; fprintf(‘%d/%d: %s %s\n‘, i, N, imname, cname); convert([source_root_dir, mode], [target_root_dir, mode], cname) end end function convert(source_root_dir, target_root_dir, cname) im_c = imread([source_root_dir ‘/‘ ‘cloth-parse-seg/‘ 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-parse-seg-mask/‘ cname]); end
--
标签:cname atl height nova txt dir matlab src function
原文地址:https://www.cnblogs.com/xiaoniu-666/p/13072941.html