Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
vision_utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
algorithms
vision_utils
Commits
f0c1f686
Commit
f0c1f686
authored
7 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add average computing times
parent
9a47e8d0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/examples/fundamental_matrix.cpp
+32
-3
32 additions, 3 deletions
src/examples/fundamental_matrix.cpp
src/examples/yaml/fundamental_matrix.yaml
+3
-3
3 additions, 3 deletions
src/examples/yaml/fundamental_matrix.yaml
with
35 additions
and
6 deletions
src/examples/fundamental_matrix.cpp
+
32
−
3
View file @
f0c1f686
...
...
@@ -153,6 +153,11 @@ int main(int argc, char** argv)
KeyPointVector
keypoints_1
=
det_ptr
->
detect
(
image_buffer
.
back
());
cv
::
Mat
descriptors_1
=
des_ptr
->
getDescriptor
(
image_buffer
.
back
(),
keypoints_1
);
clock_t
tStart
,
tDet
,
tDesc
,
tMatch
,
tFilter
,
tFund
;
double
t_det
(
0
),
t_desc
(
0
),
t_match
(
0
),
t_filter
(
0
),
t_fund
(
0
);
const
int
CLOCKS_PER_MSEC
=
(
CLOCKS_PER_SEC
/
1000
);
int
n_iter
=
0
;
while
(
1
)
{
capture
>>
img
;
...
...
@@ -167,15 +172,22 @@ int main(int argc, char** argv)
DMatchVector
good_matches
,
inlier_matches
;
PointVector
inliers_1
,
inliers_2
;
tStart
=
clock
();
// detect and describe in new image
KeyPointVector
keypoints_2
=
det_ptr
->
detect
(
img
);
tDet
=
clock
();
if
(
keypoints_2
.
size
()
>
0
)
{
image_buffer
.
add
(
img
);
cv
::
Mat
descriptors_2
=
des_ptr
->
getDescriptor
(
image_buffer
.
back
(),
keypoints_2
);
tDesc
=
clock
();
unsigned
int
max_dist
=
0
;
unsigned
int
min_dist
=
512
;
...
...
@@ -185,6 +197,8 @@ int main(int argc, char** argv)
//-- Step 3: Matching descriptor vectors using FLANN matcher
mat_ptr
->
match
(
descriptors_1
,
descriptors_2
,
des_ptr
->
getSize
(),
matches
);
tMatch
=
clock
();
//-- Quick calculation of max and min distances between keypoints
for
(
int
ii
=
0
;
ii
<
descriptors_1
.
rows
;
ii
++
)
{
...
...
@@ -215,13 +229,17 @@ int main(int argc, char** argv)
}
}
tFilter
=
clock
();
// Compute the Fundamental matrix F and discard outliers through ransac in one go
if
(
good_matches
.
size
()
>
20
)
// Minimum is 8 points, but we need more for robustness
{
// find fundamental matrix using RANSAC, return set of inliers as bool vector
cv
::
Mat
F
=
findFundamentalMat
(
matched_1
,
matched_2
,
cv
::
FM_RANSAC
,
3.0
,
0.98
,
inliers_bool
);
cv
::
Mat
F
=
findFundamentalMat
(
matched_1
,
matched_2
,
cv
::
FM_RANSAC
,
2.0
,
0.98
,
inliers_bool
);
std
::
cout
<<
"F = "
<<
F
<<
std
::
endl
;
std
::
cout
<<
"F = "
<<
F
<<
std
::
endl
;
// Recover the inlier matches
for
(
unsigned
int
ii
=
0
;
ii
<
good_matches
.
size
();
ii
++
)
...
...
@@ -229,11 +247,22 @@ int main(int argc, char** argv)
inlier_matches
.
push_back
(
good_matches
[
ii
]);
}
std
::
cout
<<
"Matches: initial "
<<
matches
.
size
()
<<
" | good "
<<
good_matches
.
size
()
<<
" | inliers "
tFund
=
clock
();
std
::
cout
<<
"Matches: initial "
<<
matches
.
size
()
<<
" | good "
<<
good_matches
.
size
()
<<
" | inliers "
<<
inlier_matches
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"kp1: "
<<
keypoints_1
.
size
()
<<
" kp2: "
<<
keypoints_2
.
size
()
<<
" inliers:"
<<
inlier_matches
.
size
()
<<
std
::
endl
;
n_iter
++
;
t_det
+=
double
(
tDet
-
tStart
)
/
CLOCKS_PER_MSEC
;
t_desc
+=
double
(
tDesc
-
tDet
)
/
CLOCKS_PER_MSEC
;
t_match
+=
double
(
tMatch
-
tDesc
)
/
CLOCKS_PER_MSEC
;
t_filter
+=
double
(
tFilter
-
tMatch
)
/
CLOCKS_PER_MSEC
;
t_fund
+=
double
(
tFund
-
tFilter
)
/
CLOCKS_PER_MSEC
;
std
::
cout
<<
"det: "
<<
t_det
/
n_iter
<<
"ms - desc: "
<<
t_desc
/
n_iter
<<
"ms - match: "
<<
t_match
/
n_iter
<<
"ms - filter: "
<<
t_filter
/
n_iter
<<
"ms - fund: "
<<
t_fund
/
n_iter
<<
"ms"
<<
std
::
endl
;
std
::
cout
<<
"+++++++++++++++"
<<
std
::
endl
;
// Draw RANSAC inliers
...
...
This diff is collapsed.
Click to expand it.
src/examples/yaml/fundamental_matrix.yaml
+
3
−
3
View file @
f0c1f686
detector
:
type
:
"
AGAST"
threshold
:
10
threshold
:
8
nonmaxSuppression
:
true
detection type
:
3
# AGAST_5_8=0, AGAST_7_12d=1, AGAST_7_12s=2, OAST_9_16=3, THRESHOLD=10000, NONMAX_SUPPRESSION=10001
detection type
:
0
# AGAST_5_8=0, AGAST_7_12d=1, AGAST_7_12s=2, OAST_9_16=3, THRESHOLD=10000, NONMAX_SUPPRESSION=10001
descriptor
:
type
:
"
BRIEF"
bytes
:
32
bytes
:
16
use_orientation
:
false
matcher
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment