forked from xyang35/BurstImageDenoising
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_homography2.m
51 lines (41 loc) · 1.3 KB
/
check_homography2.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
clear all
addpath(genpath('./include'));
imageNum = 10;
ref = 5; % set the reference image to be the 5th one
%base_dir = '/localdisk/xyang/PS_data/burstimages_v1/';
base_dir ='./';
name1 = 'Bookshelf_2';
image_path = [base_dir, name1];
% load images
imageSet = cell(1, imageNum);
ratio = 1;
for i = 1 : imageNum
image_dir = fullfile(image_path, [num2str(i - 1), '.jpg']);
imageSet{i} = rgb2gray(imresize(imread(image_dir), ratio));
end
[rows, cols] = size(imageSet{5});
% load homography flow
%version = 'fix12';
%version = 'ori';
%name2 = [name1, '_hnew_', version, '.mat'];
%homography_path = ['/localdisk/xyang/PS_data/', name2];
homography_path = ['result/', name1, '_refined.mat'];
load(homography_path);
return
% inverse transform
TransferSet = uint8(zeros(rows, cols, imageNum));
for i = 1 : length(imageSet)
disp(i);
if i == ref
TransferSet(:,:,i) = imageSet{i};
end
ithImage = backwardTransform(imageSet{i}, homographyflow{i});%%%%%ATTENTION HERE%%%%%ATTENTION HERE%%%%%ATTENTION HERE%%%%%
TransferSet(:,:,i) = ithImage;
end
% calculate errors
error_record = zeros(1, imageNum);
for i = 1 : imageNum
error = norm(double(TransferSet(:,:,i))-double(imageSet{ref}), 'fro');
error_record(i) = error;
end
avg_error = mean([error_record(1:ref-1),error_record(ref+1:end)])