Skip to content

Commit 31d626d

Browse files
committed
Add 'reprojection_error' and use it with Roh dataset
1 parent 0518219 commit 31d626d

14 files changed

+48
-28
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Use `help` command to know each function in detail, for example, `help observe_d
1515
* __3D Localization Algorithms__: localize3d\_\*.m
1616
* __Observation Functions__: [observe_distance.m][], [observe_distance_relative.m][], [observe_bearing.m][], [observe_displacement.m][], [observe_pose.m][]
1717
* __Random Noise Generators__: [apply_noise_gauss.m][]
18-
* __Accuracy Criteria__: [error_position.m][], [error_orientation.m][]
18+
* __Accuracy Criteria__: [error_position.m][], [error_orientation.m][], [error_reprojection.m][]
1919
* __Utility Functions__
2020
* Unit-test: [test_is_true.m][], [test_is_near.m][]
2121
* Angular Conversions: [tran_rad2deg.m][], [tran_deg2rad.m][], [tran_rad2rot.m][], [tran_rot2rad.m][], [trim_rad.m][]
@@ -70,6 +70,7 @@ The authors thank to the following contributors and projects.
7070
[apply_noise_gauss.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/apply_noise_gauss.m
7171
[error_position.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/error_position.m
7272
[error_orientation.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/error_orientation.m
73+
[error_reprojection.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/error_reprojection.m
7374
[test_is_true.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/test_is_true.m
7475
[test_is_near.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/test_is_near.m
7576
[tran_rad2deg.m]: https://github.com/SunglokChoi/Triangulation-Toolbox/blob/master/tran_rad2deg.m
Loading
Loading
Loading
Loading

error_reprojection.m

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function [d] = error_reprojection(p, q)
2+
%ERROR_POSITION Calculate Euclidean distance between two vectors.
3+
%
4+
% D = ERROR_POSITION(P, Q)
5+
% (matrix) P: A vector (1xN matrix, Nx1 matrix)
6+
% (matrix) Q: A vector (1xN matrix, Nx1 matrix)
7+
% (scalar) D: Euclidean distance between P and Q
8+
%
9+
% Note: Two vectors, P and Q, should be same size.
10+
%
11+
% Example:
12+
% p = [82; 3; 29];
13+
% q = [84; 10; 18];
14+
% d = error_position(p, q)
15+
16+
d = norm(p - q);

observe_bearing.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
% Examples:
3333
% map = [ 0, 0, 5, 0, 0, 0; ...
3434
% 5, 0, 5, 0, 0, 0; ...
35-
% 5, 5, 5, 0, 0, 0 ];
35+
% 5, 5, 5, 0, 0, 0; ...
3636
% 0, 5, 5, 0, 0, 0 ];
3737
% pose = [ 3, 2, 9, 0, 0, pi / 2 ];
3838
% [obsData, obsMap] = observe_bearing(map, pose)

observe_displacement.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
% Example:
2828
% map = [ 0, 0, 5, 0, 0, 0; ...
2929
% 5, 0, 5, 0, 0, 0; ...
30-
% 5, 5, 5, 0, 0, 0 ];
30+
% 5, 5, 5, 0, 0, 0; ...
3131
% 0, 5, 5, 0, 0, 0 ];
3232
% pose = [ 3, 2, 9, 0, 0, pi / 2 ];
3333
% [obsData, obsMap] = observe_displacement(map, pose)

observe_distance.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
% Example:
2525
% map = [ 0, 0, 5, 0, 0, 0; ...
2626
% 5, 0, 5, 0, 0, 0; ...
27-
% 5, 5, 5, 0, 0, 0 ];
27+
% 5, 5, 5, 0, 0, 0; ...
2828
% 0, 5, 5, 0, 0, 0 ];
2929
% pose = [ 3, 2, 9, 0, 0, pi / 2 ];
3030
% [obsData, obsMap] = observe_distance(map, pose)

observe_distance_relative.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
% Example:
2525
% map = [ 0, 0, 5, 0, 0, 0; ...
2626
% 5, 0, 5, 0, 0, 0; ...
27-
% 5, 5, 5, 0, 0, 0 ];
27+
% 5, 5, 5, 0, 0, 0; ...
2828
% 0, 5, 5, 0, 0, 0 ];
2929
% pose = [ 3, 2, 9, 0, 0, pi / 2 ];
3030
% [obsData, obsMap] = observe_distance_relative(map, pose)

observe_pose.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
% Example:
2828
% map = [ 0, 0, 5, 0, 0, 0; ...
2929
% 5, 0, 5, 0, 0, 0; ...
30-
% 5, 5, 5, 0, 0, 0 ];
30+
% 5, 5, 5, 0, 0, 0; ...
3131
% 0, 5, 5, 0, 0, 0 ];
3232
% pose = [ 3, 2, 9, 0, 0, pi / 2 ];
3333
% [obsData, obsMap] = observe_displacement(map, pose)

run_draw_distribution.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
hold off;
3838

3939
% Draw distribution of position/orientation error (CDF)
40-
xtext = { 'distance [m]', 'angle [deg]' };
41-
ytext = { 'P(position error < distance)', 'P(orientation error < angle)' };
42-
for cr = 1:2
40+
xtext = { 'distance [m]', 'angle [deg]', 'angle [deg]' };
41+
ytext = { 'P(position error < distance)', 'P(orientation error < angle)', 'P(reprojection error < angle)' };
42+
for cr = 1:(size(criteria.name, 2) - 2)
4343
med = median(median(record.perf{target.ex,target.v}(:,cr,config.algoSelM)));
4444
if med == 0, med = 1; end
4545
bins = 0:(histogram.scale*med/histogram.bin):histogram.scale*med;

run_eval_random.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
5, 2, 'Shim02-Imp', @localize2d_shimshoni02_improved, @observe_bearing, 3, [1 1 0 0 0 1], 'b+-'; ...
2626
6, 2, 'Se05', @localize2d_se05, @observe_displacement, 2, [1 1 0 0 0 1], 'rs-'; ...
2727
7, 2, 'Sayed05-AOA', @localize2d_sayed05_aoa, @observe_displacement, 2, [1 1 0 0 0 1], 'ko-'; ...
28-
8, 3, 'Sayed05-TOA3D',@localize3d_sayed05_toa, @observe_distance, 4, [1 1 1 0 0 0], 'kx:'; ...
29-
9, 3, 'Thomas05', @localize3d_thomas05, @observe_distance, 3, [1 1 1 0 0 0], 'm+-'; ...
28+
8, 2, 'Pose', @localize2d_pose, @observe_pose, 1, [1 1 0 0 0 1], 'r--'; ...
29+
9, 3, 'Sayed05-TOA3D',@localize3d_sayed05_toa, @observe_distance, 4, [1 1 1 0 0 0], 'kx:'; ...
30+
10, 3, 'Thomas05', @localize3d_thomas05, @observe_distance, 3, [1 1 1 0 0 0], 'm+-'; ...
3031
};
3132
config.verbose = true; % Show progress of experiments (true or false)
3233
config.warning = 'off'; % Show warning during experiments ('on' or 'off')

run_eval_roh.m

+19-17
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,30 @@
1919
};
2020
config.pose = ... % A list of ground truth
2121
[ ...
22-
1.50, 1.44, 0, 0, 0, tran_deg2rad(90.7); ...
23-
1.50, 2.92, 0, 0, 0, tran_deg2rad(90.9); ...
24-
1.58, 4.54, 0, 0, 0, tran_deg2rad(85.5); ...
25-
3.01, 1.43, 0, 0, 0, tran_deg2rad(87.1); ...
26-
3.05, 2.93, 0, 0, 0, tran_deg2rad(88.9); ...
27-
3.09, 4.55, 0, 0, 0, tran_deg2rad(91.3); ...
28-
4.50, 1.39, 0, 0, 0, tran_deg2rad(88.5); ...
29-
4.53, 2.98, 0, 0, 0, tran_deg2rad(89.9); ...
30-
4.51, 4.47, 0, 0, 0, tran_deg2rad(90.5); ...
22+
1.50, 1.50, 0, 0, 0, tran_deg2rad(90.0); ...
23+
1.50, 3.00, 0, 0, 0, tran_deg2rad(90.0); ...
24+
1.50, 4.50, 0, 0, 0, tran_deg2rad(90.0); ...
25+
3.00, 1.50, 0, 0, 0, tran_deg2rad(90.0); ...
26+
3.00, 3.00, 0, 0, 0, tran_deg2rad(90.0); ...
27+
3.00, 4.50, 0, 0, 0, tran_deg2rad(90.0); ...
28+
4.50, 1.50, 0, 0, 0, tran_deg2rad(90.0); ...
29+
4.50, 3.00, 0, 0, 0, tran_deg2rad(90.0); ...
30+
4.50, 4.50, 0, 0, 0, tran_deg2rad(90.0); ...
3131
];
3232
config.algorithm = ... % Description of localization algorithms
3333
{ ...
34-
% #, Dim, Name, Local. Function, Observation Function, Min. N, Valid, Line Sytle; ...
34+
% #, Dim, Name, Local. Function, Observation Function, Min. N, Valid, Line Sytle; ...
3535
1, 2, 'Betke97', @localize2d_betke97, @observe_bearing, 3, [1 1 0 0 0 1], 'gd-'; ...
3636
2, 2, 'Shim02-Alg', @localize2d_shimshoni02_algebraic, @observe_bearing, 3, [1 1 0 0 0 1], 'b--'; ...
3737
3, 2, 'Shim02-Imp', @localize2d_shimshoni02_improved, @observe_bearing, 3, [1 1 0 0 0 1], 'b+-'; ...
3838
};
3939
config.matFile = 'run_eval_roh.mat';
4040

41-
criteria.name = {'Position Error [m]', 'Orientation Error [deg]', ...
42-
'Computing Time [msec]', 'Number of Failures'}; % Name of evaluation criteria
43-
criteria.repr = {@median, @median, @median, @sum}; % Functions for calculating representive values
44-
% (e.g. mean, median, std, and sum)
45-
criteria.format = {'%.6f', '%.3f', '%.6f', '%d'}; % Format for printing text
41+
criteria.name = {'Position Error [m]', 'Orientation Error [deg]', 'Reprojection Error [deg]', ...
42+
'Computing Time [msec]', 'Number of Failures'}; % Name of evaluation criteria
43+
criteria.repr = {@median, @median, @median, @median, @sum}; % Functions for calculating representive values
44+
% (e.g. mean, median, std, and sum)
45+
criteria.format = {'%.6f', '%.3f', '%.3f', '%.6f', '%d'}; % Format for printing text
4646

4747
% Perform experiments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4848
config.algoDims = 2;
@@ -75,8 +75,10 @@
7575
elapse = toc * 1000; % [sec] to [msec]
7676
set.perf(1,1,m) = error_position(truth(1:3), pose(1:3));
7777
set.perf(1,2,m) = tran_rad2deg(error_orientation(truth(4:6), pose(4:6))); % [rad] to [deg]
78-
set.perf(1,3,m) = elapse;
79-
set.perf(1,4,m) = ~isequal(valid, config.algorithm{m,config.algoVald});
78+
projection = observe_bearing(map, pose);
79+
set.perf(1,3,m) = tran_rad2deg(norm(trim_rad(obsData - projection))); % [rad] to [deg]
80+
set.perf(1,4,m) = elapse;
81+
set.perf(1,5,m) = ~isequal(valid, config.algorithm{m,config.algoVald});
8082
set.pose(1,:,m) = pose;
8183
end
8284
record.perf{1,1} = [record.perf{1,1}; set.perf];

0 commit comments

Comments
 (0)