-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrunme.m
executable file
·67 lines (58 loc) · 1.99 KB
/
runme.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
addpath('./forpublish');
rs_new2 = {};
% Please run ./download.sh to obtain the two mat files.
load ./intemediate/result_camera_ready_Mar23.mat;
load ./intemediate/camera_ready_smallimages.mat;
% tracing parameters...
% optionsTracing = struct('patchSize', 21, 'nAngle', 30, 'step', 3, 'nHistory', 15, 'lambda', 0.001, 'nPoint', 100, 'accessRegion', accessRegion);
%%
tic
for i = 51; % to check other images, change "51" with [5, 51, 52, 65, 77]
fprintf(1, 'deal with image = %d\n', i);
% rs_new2{i}.bbox and rs_new2{i}.pts are manually labeled.
% (rs_new2{i}.seeds can be traced from rs_new2{i}.pts using the )
rs_new2{i}.bResample = false;
rs_new2{i}.smallImg = imgsBatch{i};
rs_new2{i}.scale = scales(i);
rs_new2{i}.bScale = true;
% tracing parameters..
rs_new2{i}.lambda = 0.001;
rs_new2{i}.step = 3;
rs_new2{i}.resampleRatio = 0.5;
%rs{i}.bbox = bboxes(i, :);
% rs{i}.p1 = p1(i, :);
% rs{i}.p2 = p2(i, :);
% rs{i}.bUseP = true;
rs_new2{i}.bUseP = false;
% dataset...
img = im2double(rgb2gray(imread(sprintf('./forpublish/%02d.jpg', i))));
% img = dataset_document(i);
rs_new2{i} = rectify_image_2_tracing(img, rs_new2{i});
rs_new2{i} = rectify_image_2_vertical(img, rs_new2{i});
rs_new2{i} = rectify_image_2_recon(img, rs_new2{i});
rs_new2{i} = rectify_image_2_rectify(img, rs_new2{i});
visualize_result(img, rs_new2{i});
end;
t = toc;
%%
[imgBatch, scale, meanMag] = textreg_scale(img);
%%
rs.bResample = false;
rs.smallImg = imgBatch;
rs.scale = scale;
rs.bScale = true;
% tracing parameters..
rs.lambda = 0.001;
rs.step = 3;
rs.resampleRatio = 0.5;
%rs.bbox = [426, 45, 1037, 708];
rs.bbox = [20, 15, 628, 480];
%rs{i}.bbox = bboxes(i, :);
% rs{i}.p1 = p1(i, :);
% rs{i}.p2 = p2(i, :);
% rs{i}.bUseP = true;
rs.bUseP = false;
rs = rectify_image_2_tracing(img, rs);
rs = rectify_image_2_vertical(img, rs);
rs = rectify_image_2_recon(img, rs);
rs = rectify_image_2_rectify(img, rs);