Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
1e67beb7
Commit
1e67beb7
authored
Nov 17, 2013
by
Davis King
Browse files
Added unit tests for new inv() functions for the point transformation objects.
parent
2a4e62f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
dlib/test/geometry.cpp
dlib/test/geometry.cpp
+6
-0
No files found.
dlib/test/geometry.cpp
View file @
1e67beb7
...
@@ -638,11 +638,14 @@ namespace
...
@@ -638,11 +638,14 @@ namespace
to
.
push_back
(
vect
(
0
,
0
));
to
.
push_back
(
vect
(
0
,
0
));
point_transform_affine
t
=
find_affine_transform
(
from
,
to
);
point_transform_affine
t
=
find_affine_transform
(
from
,
to
);
point_transform_affine
tinv
=
inv
(
t
);
for
(
unsigned
long
i
=
0
;
i
<
from
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
from
.
size
();
++
i
)
{
{
dlog
<<
LINFO
<<
"affine transformation error: "
<<
length
(
t
(
from
[
i
])
-
to
[
i
]);
dlog
<<
LINFO
<<
"affine transformation error: "
<<
length
(
t
(
from
[
i
])
-
to
[
i
]);
DLIB_TEST
(
length
(
t
(
from
[
i
])
-
to
[
i
])
<
1e-14
);
DLIB_TEST
(
length
(
t
(
from
[
i
])
-
to
[
i
])
<
1e-14
);
DLIB_TEST
(
length
(
tinv
(
t
(
from
[
i
]))
-
from
[
i
])
<
1e-14
);
DLIB_TEST
(
length
(
t
(
tinv
(
from
[
i
]))
-
from
[
i
])
<
1e-14
);
}
}
}
}
...
@@ -669,6 +672,7 @@ namespace
...
@@ -669,6 +672,7 @@ namespace
H
(
2
,
2
)
=
1
+
rnd
.
get_random_gaussian
()
*
3.1
;
H
(
2
,
2
)
=
1
+
rnd
.
get_random_gaussian
()
*
3.1
;
point_transform_projective
tran
(
H
);
point_transform_projective
tran
(
H
);
point_transform_projective
traninv
=
inv
(
tran
);
const
int
num
=
rnd
.
get_random_32bit_number
()
%
8
+
4
;
const
int
num
=
rnd
.
get_random_32bit_number
()
%
8
+
4
;
...
@@ -678,6 +682,8 @@ namespace
...
@@ -678,6 +682,8 @@ namespace
dlib
::
vector
<
double
,
2
>
p
=
randm
(
2
,
1
,
rnd
)
*
1000
;
dlib
::
vector
<
double
,
2
>
p
=
randm
(
2
,
1
,
rnd
)
*
1000
;
from_points
.
push_back
(
p
);
from_points
.
push_back
(
p
);
to_points
.
push_back
(
tran
(
p
)
+
(
randm
(
2
,
1
,
rnd
)
-
0.5
)
*
error_rate
);
to_points
.
push_back
(
tran
(
p
)
+
(
randm
(
2
,
1
,
rnd
)
-
0.5
)
*
error_rate
);
DLIB_TEST
(
length
(
traninv
(
tran
(
p
))
-
p
)
<=
1e-6
);
DLIB_TEST
(
length
(
tran
(
traninv
(
p
))
-
p
)
<=
1e-6
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment