Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfujun committed Apr 10, 2018
1 parent 41d3115 commit 4339cce
Show file tree
Hide file tree
Showing 36 changed files with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions filt_cnn_artifact.m
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
% parpool(8)
% parfor i = 0 : 43
for i = 2:2 % 70:72
% parfor i = 0 : 149

for i = 0:34
close all

in_fn = ['results/' int2str(i) '_final_res.png'];
out_fn = ['results/' int2str(i) '_final_res2.png'];

in_fn = [int2str(i) '_result.jpg'];
out_fn = [int2str(i) '_result2.jpg'];


% in_fn = ['../tmp36_wikiart2_current_more/' int2str(i) '_result.png'];
% out_fn = ['../tmp36_wikiart2_current_more/' int2str(i) '_result2.png'];


if exist(in_fn, 'file') ~= 2
fprintf('file doesn''t exist: %s\n', in_fn);
continue
end
if exist(out_fn, 'file') == 2
fprintf('result already exists: %s\n', out_fn);
continue
end

I = im2double(imread(in_fn));
G = im2double(imread(['free2use/' int2str(i) '_naive.png']));
M = im2double(imread(['free2use/' int2str(i) '_c_mask.png']));
B = im2double(imread(['free2use/' int2str(i) '_target.jpg']));

G = im2double(imread(['data/' int2str(i) '_naive.jpg']));
M = im2double(imread(['data/' int2str(i) '_c_mask.jpg']));
B = im2double(imread(['data/' int2str(i) '_target.jpg']));


tr= 3;
h = fspecial('gaussian', [2*tr+1 2*tr+1], tr);
sM = imfilter(M, h, 'same');
sM(sM > 0.01) = 1; % dialte
sM(sM < 0.01) = 0;
sM = imfilter(sM, h, 'same');

addpath code/colorspace
addpath 3rdparty/colorspace
I_lab = colorspace('rgb->lab', I);

addpath code/guided_filter
addpath code/patchmatch-2.0
addpath 3rdparty/guided_filter
addpath 3rdparty/patchmatch-2.0

r = 2; % try r=2, 4, or 8
eps = 0.1^2; % try eps=0.1^2, 0.2^2, 0.4^2
Expand All @@ -47,12 +49,12 @@
patch_w = 7;
ann = nnmex(O1, B, algo, patch_w, [], [], [], [], [], cores);
O2_base = im2double(votemex(B, ann));

r = 3;
h = fspecial('gaussian', [2*r+1 2*r+1], r/3);
O1_base = imfilter(O1, h, 'same');
O2 = O2_base + O1 - O1_base;

O2 = O2.*sM + B.*(1-sM);
figure; imshow(I)
figure; imshow(O2)
Expand Down
Binary file added results/0_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/10_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/11_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/12_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/13_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/14_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/15_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/16_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/17_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/18_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/19_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/1_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/20_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/21_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/22_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/23_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/24_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/25_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/26_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/27_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/28_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/29_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/2_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/30_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/31_final_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added results/32_final_res2.png
Binary file added results/33_final_res2.png
Binary file added results/34_final_res2.png
Binary file added results/3_final_res2.png
Binary file added results/4_final_res2.png
Binary file added results/5_final_res2.png
Binary file added results/6_final_res2.png
Binary file added results/7_final_res2.png
Binary file added results/8_final_res2.png
Binary file added results/9_final_res2.png

0 comments on commit 4339cce

Please sign in to comment.