CG_图片轮廓mask提取-matlab
Posted xiaoniu-666
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CG_图片轮廓mask提取-matlab相关的知识,希望对你有一定的参考价值。
<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 rain_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 ‘, 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
--
以上是关于CG_图片轮廓mask提取-matlab的主要内容,如果未能解决你的问题,请参考以下文章