forked from luanfujun/deep-painterly-harmonization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdilate_mask.m
More file actions
33 lines (30 loc) · 693 Bytes
/
Copy pathdilate_mask.m
File metadata and controls
33 lines (30 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
for i = 0 : 34
close all;
fn = [int2str(i) '_c_mask.png']
I = im2double(imread(fn));
[h w c] = size(I);
if c == 3
I = I(:,:,1);
end
h1 = h;
w1 = w;
if h ~= 700 && w ~= 700
if h > w
h1 = 700;
w1 = floor(h1 * w/h);
else
w1 = 700;
h1 = floor(w1 * h/w);
end
end
figure; imshow(I)
r = 35;
h = fspecial('gaussian', [r r], r/3);
J = imfilter(I, h, 'same');
figure; imshow(J)
J2 = J;
J2(J>0.1) = 1;
J2(J<=0.1) = 0;
figure; imshow(J2)
imwrite(J2, [int2str(i) '_c_mask_dilated.png']);
end