-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpic_built.m
34 lines (31 loc) · 1.11 KB
/
pic_built.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
function rez = pic_built(T, A, tileResX, tileResY, tileX, tileY)
[aa, num] = size(A);
%block sizes
x = tileResX;
y = tileResY;
%get values: mean color, rgb historgam via bins, HOG, texture
means = cell(1, num);
bins = cell(1, num);
hog = cell(1, num);
%texture = cell(1, num);
for z = 1:num
means{z} = mean_calculation(A{z});
bins{z} = RGB_bins(A{z});
hog{z} = extractHOGFeatures(A{z});
%texture{z} = feature_box(A{z});
end
f = waitbar(0, "Generating composite image");
for i = 1:tileX
for j = 1:tileY
%disp("" + i + " " + j);
that_piece = T((i-1)*x+1:i*x, (j-1)*y+1:j*y, :);
similarity_values = similarity_check(that_piece, A, means, bins, hog);
[val, index] = min(similarity_values);
rez((i-1)*x+1:i*x, (j-1)*y+1:j*y, :) = A{index};
%waitbar((i*tileY+j)/(tileY * tileX), f, "Generating mosaic");
end
waitbar(i/tileX, f, "Generating composite image");
end
close(f);
%imwrite(rez, "Images\composite_image_1.jpg");
end