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
5fa7b5bb
Commit
5fa7b5bb
authored
Jul 20, 2015
by
Kurnianggoro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add preprocessor directive to use flann
parent
bab52b03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
multitracker.cpp
modules/tracking/samples/multitracker.cpp
+31
-3
No files found.
modules/tracking/samples/multitracker.cpp
View file @
5fa7b5bb
...
...
@@ -3,19 +3,28 @@
* example_tracking_multitracker <video_name> [algorithm]
*
* example:
* example_tracking_multitracker Bolt/img/%04.jpg
* example_tracking_multitracker Bolt/img/%04
d
.jpg
* example_tracking_multitracker faceocc2.webm KCF
*
* Note: after the OpenCV libary is installed,
* please re-compile this code with "HAVE_OPENCV" parameter activated
* to enable the high precission of fps computation
*--------------------------------------------------*/
#define HAVE_OPENCV
#include <opencv2/core/utility.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include "opencv2/flann/timer.h" // it should be opencv2/flann.hpp
#include <iostream>
#include <cstring>
#include <ctime>
#ifdef HAVE_OPENCV
#include <opencv2/flann.hpp>
#endif
#define RESET "\033[0m"
#define RED "\033[31m"
/* Red */
#define GREEN "\033[32m"
/* Green */
...
...
@@ -60,14 +69,22 @@ int main( int argc, char** argv ){
cout
<<
" Usage: example_tracking_multitracker <video_name> [algorithm]
\n
"
" examples:
\n
"
" example_tracking_multitracker Bolt/img/%04.jpg
\n
"
" example_tracking_multitracker Bolt/img/%04
d
.jpg
\n
"
" example_tracking_multitracker faceocc2.webm MEDIANFLOW
\n
"
"
\n
"
" Note: after the OpenCV libary is installed,
\n
"
" please re-compile with the HAVE_OPENCV parameter activated
\n
"
" to enable the high precission of fps computation.
\n
"
<<
endl
;
return
0
;
}
// timer
#ifdef HAVE_OPENCV
cvflann
::
StartStopTimer
timer
;
#else
clock_t
timer
;
#endif
// for showing the speed
double
fps
;
...
...
@@ -118,15 +135,26 @@ int main( int argc, char** argv ){
break
;
// start the timer
#ifdef HAVE_OPENCV
timer
.
start
();
#else
timer
=
clock
();
#endif
//update the tracking result
trackers
.
update
(
frame
);
// calculate the processing speed
#ifdef HAVE_OPENCV
timer
.
stop
();
fps
=
1.0
/
timer
.
value
;
timer
.
reset
();
#else
timer
=
clock
();
trackers
.
update
(
frame
);
timer
=
clock
()
-
timer
;
fps
=
(
double
)
CLOCKS_PER_SEC
/
(
double
)
timer
;
#endif
// draw the tracked object
for
(
unsigned
i
=
0
;
i
<
trackers
.
objects
.
size
();
i
++
)
...
...
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