Skip to content

Commit

Permalink
add dilate_mask.m
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfujun committed Apr 16, 2018
1 parent b563f97 commit 15ede65
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions dilate_mask.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 15ede65

Please sign in to comment.