-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.m
More file actions
100 lines (80 loc) · 3.24 KB
/
example.m
File metadata and controls
100 lines (80 loc) · 3.24 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
function example(featureFolder)
% featureFolder = '../' % The folder that contains the files XYZ.txt,
% train.txt, test.txt, vectorNormals.txt
%load the XYZ1 txt file with the format
% X Y Z
XYZ1 = load(fullfile(featureFolder, 'XYZ.txt'));
%returns the different planes with RANSAC segmentation, stores them in the
%folder featureFolder and if they exist loads them from there, otherwise it
%computes them
planesFilename = fullfile(featureFolder, 'planes.mat');
if exist(planesFilename, 'file')
load planesFilename
else
planes = ransacSegmentationFun(XYZ1, 0.2);
save(planesFilename,'planes');
end
for index = 1 : size(planes,2)
planeD = planes{index};
filename = 'orthoImage';
indexstr = num2str(index);
orthofileName = strcat(filename,indexstr);
fullorthoFilename = fullfile(featureFolder, orthofileName);
if exist(fullorthoFilename, 'file')
load fullorthoFilename
else
[orthoImage, orthoImageCoordinates, rmat] = orthoFun(planeD, 'D:\hayko-all\ruemonge\undistorted_images_and_camera_matrix\');
save(fullorthoFilename,'orthoImage','orthoImageCoordinates','rmat');
end
%created the orthoImage and the correspondence betweeen orthoImage and
%3D space (orthoImageCoordinates)
%[orthoImage, orthoImageCoordinates, rmat] = orthoFun(planeD, index);
filename = 'indexing';
indexingfileName = strcat(filename,indexstr);
fullindexingfileName = fullfile(featureFolder, indexingfileName );
if exist(fullindexingfileName, 'file')
load fullindexingfileName
else
indexOfImage = pointCloudToOrthoFun(planeD, rmat, orthoImageCoordinates);
save(fullindexingfileName,'indexOfImage');
end
%rgb/lab features
filename = 'RGB_Lab';
rgblabfileName = strcat(filename,indexstr);
fullrgblabfileName = fullfile(featureFolder, rgblabfileName );
if exist(fullrgblabfileName, 'file')
load fullrgblabfileName
else
[RGBvalues, Labvalues] = RGBLABFeaturesFun(indexOfImage, orthoImage, index);
save(fullindexingfileName,'RGBvalues','Labvalues');
end
%census features
filename = 'Census';
censusfileName = strcat(filename,indexstr);
fullcensusfileName = fullfile(featureFolder, censusfileName );
if exist(fullcensusfileName, 'file')
load fullcensusfileName
else
censusFeatures = censusFeaturesFun(indexOfImage, orthoImage, index);
save(fullcensusfileName,'censusFeatures');
end
%depth
filename = 'depth';
depthfileName = strcat(filename,indexstr);
fulldepthfileName = fullfile(featureFolder, depthfileName );
if exist(fulldepthfileName, 'file')
load fulldepthfileName
else
depthFeatures = calculateDepthFun(planeD, rmat);
save(fulldepthfileName,'depthFeatures');
end
%load the test train/test/vector normal files provided in github
train = load('../train.txt');
test = load('../test.txt');
vectorNormals = load('../vector_normals.txt');
%vectorNormals
[train, test, vectorNormals] = computeTrainTestFun(train, test, vectorNormals, planeD);
%na sumpliriwsw to load vectorNormals kai to write test train kai na
%lew poia einai poia
clearvars -except planes
end