Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
ace71cef
Commit
ace71cef
authored
Nov 21, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Affine3<T>::rvec()
parent
9f1f5aed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
affine.hpp
modules/core/include/opencv2/core/affine.hpp
+52
-0
No files found.
modules/core/include/opencv2/core/affine.hpp
View file @
ace71cef
...
...
@@ -97,6 +97,9 @@ namespace cv
Mat3
linear
()
const
;
Vec3
translation
()
const
;
//Rodrigues vector
Vec3
rvec
()
const
;
Affine3
inv
(
int
method
=
cv
::
DECOMP_SVD
)
const
;
// a.rotate(R) is equivalent to Affine(R, 0) * a;
...
...
@@ -300,6 +303,55 @@ typename cv::Affine3<T>::Vec3 cv::Affine3<T>::translation() const
return
Vec3
(
matrix
.
val
[
3
],
matrix
.
val
[
7
],
matrix
.
val
[
11
]);
}
template
<
typename
T
>
inline
typename
cv
::
Affine3
<
T
>::
Vec3
cv
::
Affine3
<
T
>::
rvec
()
const
{
cv
::
Vec3d
w
;
cv
::
Matx33d
u
,
vt
,
R
=
rotation
();
cv
::
SVD
::
compute
(
R
,
w
,
u
,
vt
,
cv
::
SVD
::
FULL_UV
+
cv
::
SVD
::
MODIFY_A
);
R
=
u
*
vt
;
double
rx
=
R
.
val
[
7
]
-
R
.
val
[
5
];
double
ry
=
R
.
val
[
2
]
-
R
.
val
[
6
];
double
rz
=
R
.
val
[
3
]
-
R
.
val
[
1
];
double
s
=
std
::
sqrt
((
rx
*
rx
+
ry
*
ry
+
rz
*
rz
)
*
0.25
);
double
c
=
(
R
.
val
[
0
]
+
R
.
val
[
4
]
+
R
.
val
[
8
]
-
1
)
*
0.5
;
c
=
c
>
1.0
?
1.0
:
c
<
-
1.0
?
-
1.0
:
c
;
double
theta
=
acos
(
c
);
if
(
s
<
1e-5
)
{
if
(
c
>
0
)
rx
=
ry
=
rz
=
0
;
else
{
double
t
;
t
=
(
R
.
val
[
0
]
+
1
)
*
0.5
;
rx
=
std
::
sqrt
(
std
::
max
(
t
,
0.0
));
t
=
(
R
.
val
[
4
]
+
1
)
*
0.5
;
ry
=
std
::
sqrt
(
std
::
max
(
t
,
0.0
))
*
(
R
.
val
[
1
]
<
0
?
-
1.0
:
1.0
);
t
=
(
R
.
val
[
8
]
+
1
)
*
0.5
;
rz
=
std
::
sqrt
(
std
::
max
(
t
,
0.0
))
*
(
R
.
val
[
2
]
<
0
?
-
1.0
:
1.0
);
if
(
fabs
(
rx
)
<
fabs
(
ry
)
&&
fabs
(
rx
)
<
fabs
(
rz
)
&&
(
R
.
val
[
5
]
>
0
)
!=
(
ry
*
rz
>
0
)
)
rz
=
-
rz
;
theta
/=
std
::
sqrt
(
rx
*
rx
+
ry
*
ry
+
rz
*
rz
);
rx
*=
theta
;
ry
*=
theta
;
rz
*=
theta
;
}
}
else
{
double
vth
=
1
/
(
2
*
s
);
vth
*=
theta
;
rx
*=
vth
;
ry
*=
vth
;
rz
*=
vth
;
}
return
cv
::
Vec3d
(
rx
,
ry
,
rz
);
}
template
<
typename
T
>
inline
cv
::
Affine3
<
T
>
cv
::
Affine3
<
T
>::
inv
(
int
method
)
const
{
...
...
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