-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.m
81 lines (65 loc) · 1.79 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
global N_BIG;
global N_SMALL;
global NUM_FEATURES;
global NNF;
global nnf;
global A;
global B;
global kappa;
global G_big;
global G_small;
global end_idx;
% Neightborhood size and num features
N_BIG = 5;
N_SMALL = 3;
NUM_FEATURES = 1;
NNF = N_BIG * N_BIG * NUM_FEATURES;
nnf = N_SMALL * N_SMALL * NUM_FEATURES;
% end_idx = 12;
end_idx = sub2ind([N_BIG N_BIG], 2, 3);
% end_idx = sub2ind([N_BIG N_BIG], 2, 2);
kappa = 3;
G_big = fspecial('Gaussian', [N_BIG N_BIG]);
%G_big = (G_big + ones(5))/2;
G_small = fspecial('Gaussian', [N_SMALL N_SMALL]);
% Read images
% Texture transfer
% A = imread('transfer2_A1.jpg');
% A_prime = imread('transfer2_A2.jpg');
% B = imread('transfer2_B1.jpg');
% Texture synthesis
% tmp = imresize(imread('images/japanese-wallpaper.jpg'), .5);
% A = zeros(size(tmp));
% A_prime = tmp;
% B = zeros(125,125,3);
% Painting
% A = imread('images/rhone-src.jpg');
% A_prime = imread('images/rhone.jpg');
% B = imread('jakarta.jpg');
A = imread('images/swan.jpg');
A_prime = imread('images/swan-pastel.jpg');
B = imread('chicago.jpg');
% Blur
% A = imread('images/newflower-src.jpg');
% A_prime = imread('images/newflower-blur.jpg');
% B = imread('toy-newshore-src.jpg');
% Blur2
% A = imread('images/blurA1.jpg');
% A_prime = imread('images/blurA2.jpg');
% B = imread('images/blurB1.jpg');
% Identity Test
% A = imread('images/IdentityA.jpg');
% A_prime = imread('images/IdentityA.jpg');
% B = imread('IdentityB.jpg');
% %% Emboss Test
% A = imread('images/rose-src.jpg');
% A_prime = imread('images/rose-emboss.jpg');
% B = imread('dandilion-src.jpg');
% TODO: Remove this -- it's just faster for testing.
A_scale = 0.5;
B_scale = 0.5;
A = imresize(A, A_scale);
A_prime = imresize(A_prime, A_scale);
B = imresize(B, B_scale);
% Make image analogy
B_prime = create_image_analogy(A, A_prime, B);