forked from abhijithpunnappurath/dprr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.m
54 lines (42 loc) · 1.42 KB
/
main.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% Reflection removal using a dual-pixel sensor
% Abhijith Punnappurath and Michael S. Brown
% CVPR 2019, Long Beach, California
% Author: Abhijith Punnappurath, York University, Toronto, Canada
% Email: [email protected]
clc;
clear;
close all;
addpath(genpath('Functions'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Controlled dataset
input_folder='../Dataset/Controlled/';
save_folder='../Dataset/Controlled_results/';
lambda = 100;
thresh = 1;
p=2/3;
iter=3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% In-the-wild dataset
% input_folder='../Dataset/In-the-wild/';
% save_folder='../Dataset/In-the-wild_results/';
%
% lambda = 100;
% thresh = 0.5;
% p=2/3;
% iter=3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
allfolders=dir(input_folder);
for i=3:length(allfolders)
mkdir([save_folder allfolders(i).name]);
mixLc = imread([input_folder allfolders(i).name '/left.png']);
mixRc = imread([input_folder allfolders(i).name '/right.png']);
input_img = imread([input_folder allfolders(i).name '/input.png']);
fprintf('%s \n',allfolders(i).name);
tic
[back,ref] = dual_pixel_ref_removal(mixLc,mixRc,input_img,lambda,thresh,p,iter);
myt=toc;
fprintf('Elapsed time: %f \n',myt/60);
imwrite(back,[save_folder allfolders(i).name '/back.png'])
imwrite(ref,[save_folder allfolders(i).name '/ref.png'])
end