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
63584bc4
Commit
63584bc4
authored
Sep 18, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9444 from hrnr:akaze_tutorial
parents
f7df5dd3
f6deaf5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
planar_tracking.cpp
...torial_code/features2D/AKAZE_tracking/planar_tracking.cpp
+5
-0
stats.h
samples/cpp/tutorial_code/features2D/AKAZE_tracking/stats.h
+5
-1
utils.h
samples/cpp/tutorial_code/features2D/AKAZE_tracking/utils.h
+7
-4
No files found.
samples/cpp/tutorial_code/features2D/AKAZE_tracking/planar_tracking.cpp
View file @
63584bc4
...
...
@@ -62,8 +62,11 @@ void Tracker::setFirstFrame(const Mat frame, vector<Point2f> bb, string title, S
Mat
Tracker
::
process
(
const
Mat
frame
,
Stats
&
stats
)
{
TickMeter
tm
;
vector
<
KeyPoint
>
kp
;
Mat
desc
;
tm
.
start
();
detector
->
detectAndCompute
(
frame
,
noArray
(),
kp
,
desc
);
stats
.
keypoints
=
(
int
)
kp
.
size
();
...
...
@@ -85,6 +88,8 @@ Mat Tracker::process(const Mat frame, Stats& stats)
homography
=
findHomography
(
Points
(
matched1
),
Points
(
matched2
),
RANSAC
,
ransac_thresh
,
inlier_mask
);
}
tm
.
stop
();
stats
.
fps
=
1.
/
tm
.
getTimeSec
();
if
(
matched1
.
size
()
<
4
||
homography
.
empty
())
{
Mat
res
;
...
...
samples/cpp/tutorial_code/features2D/AKAZE_tracking/stats.h
View file @
63584bc4
...
...
@@ -7,11 +7,13 @@ struct Stats
int
inliers
;
double
ratio
;
int
keypoints
;
double
fps
;
Stats
()
:
matches
(
0
),
inliers
(
0
),
ratio
(
0
),
keypoints
(
0
)
keypoints
(
0
),
fps
(
0
.)
{}
Stats
&
operator
+=
(
const
Stats
&
op
)
{
...
...
@@ -19,6 +21,7 @@ struct Stats
inliers
+=
op
.
inliers
;
ratio
+=
op
.
ratio
;
keypoints
+=
op
.
keypoints
;
fps
+=
op
.
fps
;
return
*
this
;
}
Stats
&
operator
/=
(
int
num
)
...
...
@@ -27,6 +30,7 @@ struct Stats
inliers
/=
num
;
ratio
/=
num
;
keypoints
/=
num
;
fps
/=
num
;
return
*
this
;
}
};
...
...
samples/cpp/tutorial_code/features2D/AKAZE_tracking/utils.h
View file @
63584bc4
...
...
@@ -25,15 +25,17 @@ void drawBoundingBox(Mat image, vector<Point2f> bb)
void
drawStatistics
(
Mat
image
,
const
Stats
&
stats
)
{
static
const
int
font
=
FONT_HERSHEY_PLAIN
;
stringstream
str1
,
str2
,
str3
;
stringstream
str1
,
str2
,
str3
,
str4
;
str1
<<
"Matches: "
<<
stats
.
matches
;
str2
<<
"Inliers: "
<<
stats
.
inliers
;
str3
<<
"Inlier ratio: "
<<
setprecision
(
2
)
<<
stats
.
ratio
;
str4
<<
"FPS: "
<<
std
::
fixed
<<
setprecision
(
2
)
<<
stats
.
fps
;
putText
(
image
,
str1
.
str
(),
Point
(
0
,
image
.
rows
-
90
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
putText
(
image
,
str2
.
str
(),
Point
(
0
,
image
.
rows
-
60
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
putText
(
image
,
str3
.
str
(),
Point
(
0
,
image
.
rows
-
30
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
putText
(
image
,
str1
.
str
(),
Point
(
0
,
image
.
rows
-
120
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
putText
(
image
,
str2
.
str
(),
Point
(
0
,
image
.
rows
-
90
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
putText
(
image
,
str3
.
str
(),
Point
(
0
,
image
.
rows
-
60
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
putText
(
image
,
str4
.
str
(),
Point
(
0
,
image
.
rows
-
30
),
font
,
2
,
Scalar
::
all
(
255
),
3
);
}
void
printStatistics
(
string
name
,
Stats
stats
)
...
...
@@ -45,6 +47,7 @@ void printStatistics(string name, Stats stats)
cout
<<
"Inliers "
<<
stats
.
inliers
<<
endl
;
cout
<<
"Inlier ratio "
<<
setprecision
(
2
)
<<
stats
.
ratio
<<
endl
;
cout
<<
"Keypoints "
<<
stats
.
keypoints
<<
endl
;
cout
<<
"FPS "
<<
std
::
fixed
<<
setprecision
(
2
)
<<
stats
.
fps
<<
endl
;
cout
<<
endl
;
}
...
...
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