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
f62d7c79
"src/runtime/vscode:/vscode.git/clone" did not exist on "1f6eba9ed373b71e31cd2385654b3f7552ad5eea"
Commit
f62d7c79
authored
Feb 27, 2015
by
Davis King
Browse files
Made it so you can compose point transform objects via operator *.
parent
8237b748
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
dlib/geometry/point_transforms.h
dlib/geometry/point_transforms.h
+20
-0
dlib/geometry/point_transforms_abstract.h
dlib/geometry/point_transforms_abstract.h
+24
-0
dlib/test/geometry.cpp
dlib/test/geometry.cpp
+9
-0
No files found.
dlib/geometry/point_transforms.h
View file @
f62d7c79
...
...
@@ -190,6 +190,16 @@ namespace dlib
dlib
::
vector
<
double
,
2
>
b
;
};
// ----------------------------------------------------------------------------------------
inline
point_transform_affine
operator
*
(
const
point_transform_affine
&
lhs
,
const
point_transform_affine
&
rhs
)
{
return
point_transform_affine
(
lhs
.
get_m
()
*
rhs
.
get_m
(),
lhs
.
get_m
()
*
rhs
.
get_b
()
+
lhs
.
get_b
());
}
// ----------------------------------------------------------------------------------------
inline
point_transform_affine
inv
(
...
...
@@ -358,6 +368,16 @@ namespace dlib
matrix
<
double
,
3
,
3
>
m
;
};
// ----------------------------------------------------------------------------------------
inline
point_transform_projective
operator
*
(
const
point_transform_projective
&
lhs
,
const
point_transform_projective
&
rhs
)
{
return
point_transform_projective
(
lhs
.
get_m
()
*
rhs
.
get_m
());
}
// ----------------------------------------------------------------------------------------
inline
point_transform_projective
inv
(
...
...
dlib/geometry/point_transforms_abstract.h
View file @
f62d7c79
...
...
@@ -74,6 +74,18 @@ namespace dlib
// ----------------------------------------------------------------------------------------
point_transform_affine
operator
*
(
const
point_transform_affine
&
lhs
,
const
point_transform_affine
&
rhs
);
/*!
ensures
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That
is, for all valid x: TFORM(x) == lhs(rhs(x)).
!*/
// ----------------------------------------------------------------------------------------
point_transform_affine
inv
(
const
point_transform_affine
&
trans
);
...
...
@@ -197,6 +209,18 @@ namespace dlib
provides serialization support
!*/
// ----------------------------------------------------------------------------------------
point_transform_projective
operator
*
(
const
point_transform_projective
&
lhs
,
const
point_transform_projective
&
rhs
);
/*!
ensures
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That
is, for all valid x: TFORM(x) == lhs(rhs(x)).
!*/
// ----------------------------------------------------------------------------------------
point_transform_projective
inv
(
...
...
dlib/test/geometry.cpp
View file @
f62d7c79
...
...
@@ -646,6 +646,10 @@ namespace
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
);
point_transform_affine
temp
=
t
*
inv
(
t
);
DLIB_TEST
(
length
(
temp
.
get_b
())
<
1e-14
);
DLIB_TEST
(
max
(
abs
(
temp
.
get_m
()
-
identity_matrix
<
double
>
(
2
)))
<
1e-14
);
}
ostringstream
sout
;
...
...
@@ -692,6 +696,11 @@ namespace
to_points
.
push_back
(
tran
(
p
)
+
(
randm
(
2
,
1
,
rnd
)
-
0.5
)
*
error_rate
);
DLIB_TEST
(
length
(
traninv
(
tran
(
p
))
-
p
)
<=
1e-5
);
DLIB_TEST
(
length
(
tran
(
traninv
(
p
))
-
p
)
<=
1e-5
);
point_transform_projective
temp
=
tran
*
traninv
;
DLIB_TEST_MSG
(
max
(
abs
(
temp
.
get_m
()
-
identity_matrix
<
double
>
(
3
)))
<
1e-10
,
temp
.
get_m
());
temp
=
traninv
*
tran
;
DLIB_TEST_MSG
(
max
(
abs
(
temp
.
get_m
()
-
identity_matrix
<
double
>
(
3
)))
<
1e-10
,
temp
.
get_m
());
}
...
...
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