Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
bd9ec3d4
Commit
bd9ec3d4
authored
Mar 09, 2017
by
Hamdi Sahloul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Computation reduction of angle between two normalized vectors
parent
53e34260
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
18 deletions
+11
-18
c_utils.hpp
modules/surface_matching/src/c_utils.hpp
+8
-4
ppf_match_3d.cpp
modules/surface_matching/src/ppf_match_3d.cpp
+3
-14
No files found.
modules/surface_matching/src/c_utils.hpp
View file @
bd9ec3d4
...
...
@@ -83,11 +83,15 @@ static inline void TCross(const double a[], const double b[], double c[])
c
[
2
]
=
(
a
[
0
])
*
(
b
[
1
])
-
(
a
[
1
])
*
(
b
[
0
]);
}
static
inline
double
TAngle3
(
const
double
a
[
3
],
const
double
b
[
3
])
static
inline
double
TAngle3
Normalized
(
const
double
a
[
3
],
const
double
b
[
3
])
{
double
c
[
3
];
TCross
(
a
,
b
,
c
);
return
(
atan2
(
TNorm3
(
c
),
TDot3
(
a
,
b
)));
/*
angle = atan2(a dot b, |a x b|) # Bertram (accidental mistake)
angle = atan2(|a x b|, a dot b) # Tolga Birdal (correction)
angle = acos(a dot b) # Hamdi Sahloul (simplification, a & b are normalized)
*/
return
acos
(
TDot3
(
a
,
b
));
}
static
inline
void
matrixProduct33
(
double
*
A
,
double
*
B
,
double
*
R
)
...
...
modules/surface_matching/src/ppf_match_3d.cpp
View file @
bd9ec3d4
...
...
@@ -191,20 +191,9 @@ void PPF3DDetector::computePPFFeatures(const double p1[4], const double n1[4],
return
;
}
/*
Tolga Birdal's note:
Issues of numerical stability is of concern here.
Bertram's suggestion: atan2(a dot b, |axb|)
My correction :
I guess it should be: angle = atan2(norm(cross(a,b)), dot(a,b))
The macro is implemented accordingly.
TAngle3 actually outputs in range [0, pi] as
Bertram suggests
*/
f
[
0
]
=
TAngle3
(
n1
,
d
);
f
[
1
]
=
TAngle3
(
n2
,
d
);
f
[
2
]
=
TAngle3
(
n1
,
n2
);
f
[
0
]
=
TAngle3Normalized
(
n1
,
d
);
f
[
1
]
=
TAngle3Normalized
(
n2
,
d
);
f
[
2
]
=
TAngle3Normalized
(
n1
,
n2
);
}
void
PPF3DDetector
::
clearTrainingModels
()
...
...
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