-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathDemo.m
25 lines (19 loc) · 1.08 KB
/
Demo.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
close all; clc; clear;
addpath(genpath('./.'));
folder = './.'; % Put the image pairs in this folder
filepaths = dir(fullfile(folder, '*.png'));
for i = 1:2:size(filepaths)
I1 = im2double(imread(fullfile(folder,filepaths(i).name))); % reference image
I2 = im2double(imread(fullfile(folder,filepaths(i+1).name))); % target image
s = 2; % s = len1/len2, len1&lend2 are the focal length of captured image (len1>len2)
r = 1 - 1/s; % Scale
I2_zoom = warpImg(I2,[-r,0,0,0]);
tau0 = zeros(6,1);
iter = 3; % number of iterations
[I2_t,tau] = align_l(I2_zoom,I1,tau0,iter);
[I2_t_l] = luminance_transfer(I1,I2_t); % transfer luminance
[I2_t_c] = color_transfer(I1,I2_t); % transfer color
% where you save the image
imwrite(I1, ['./.', filepaths(i).name])
imwrite(I2_t_c, ['./.', filepaths(i+1).name])
end