-
Notifications
You must be signed in to change notification settings - Fork 4
/
cropping.m
executable file
·47 lines (42 loc) · 1.7 KB
/
cropping.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
%CROPPING.M This script calls the image_prep_crop.m function.
%
% signature_path : Location of the CEDAR signature folder database.
% Default folder: <MATLAB>/data
% database_name : Database name ('CEDAR',' MCYT','GPDS_synthetic',
% 'GPDS300', 'UTSig').
% Default: 'CEDAR'
% thinning_level : The level of the thinning process.
% Default: 1
% writer_number : The total number of the writers.
% Default: 55 ('CEDAR' has 55 writers)
% signature_number : The total number of signatures per writer.
% Default: 24 ('CEDAR' has 24 sig/writer)
%
% original : An array of cells. Each cell contains a thinned,
% centered signature, exempted from excess information.
% forgeries : -"-
signature_path = fullfile(pwd,'data');
database_name = 'CEDAR';
thinning_level = 1;
writer_number = 55;
signature_number = 24;
original = cell(writer_number, signature_number); % original cropped
forgeries = cell(writer_number, signature_number); % forgeries cropped
%% for original
for i=1:writer_number
for j=1:signature_number
imagepath = fullfile(signature_path,'full_org');
[~,original{i,j}] = ...
image_prep_crop(database_name,imagepath,'original',i,j,thinning_level);
end
end
%% for forgeries
for i=1:writer_number
for j=1:signature_number
imagepath = fullfile(signature_path,'full_forg');
[~,forgeries{i,j}] = ...
image_prep_crop(database_name,imagepath,'false',i,j,thinning_level);
end
end
%% save cropped
save(fullfile(signature_path,'cropped_images'), 'original', 'forgeries');