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
d8cec20e
Commit
d8cec20e
authored
Apr 11, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added perf test for calcOpticalFlowPyrLK
parent
47148ce2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
0 deletions
+110
-0
perf_main.cpp
modules/video/perf/perf_main.cpp
+3
-0
perf_optflowpyrlk.cpp
modules/video/perf/perf_optflowpyrlk.cpp
+93
-0
perf_precomp.cpp
modules/video/perf/perf_precomp.cpp
+1
-0
perf_precomp.hpp
modules/video/perf/perf_precomp.hpp
+13
-0
No files found.
modules/video/perf/perf_main.cpp
0 → 100644
View file @
d8cec20e
#include "perf_precomp.hpp"
CV_PERF_TEST_MAIN
(
video
)
modules/video/perf/perf_optflowpyrlk.cpp
0 → 100644
View file @
d8cec20e
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
typedef
tr1
::
tuple
<
std
::
string
,
int
,
int
,
tr1
::
tuple
<
int
,
int
>
,
int
>
Path_Idx_Cn_NPoints_WSize_t
;
typedef
TestBaseWithParam
<
Path_Idx_Cn_NPoints_WSize_t
>
Path_Idx_Cn_NPoints_WSize
;
void
FormTrackingPointsArray
(
vector
<
Point2f
>&
points
,
int
width
,
int
height
,
int
nPointsX
,
int
nPointsY
)
{
int
stepX
=
width
/
nPointsX
;
int
stepY
=
height
/
nPointsY
;
if
(
stepX
<
1
||
stepY
<
1
)
FAIL
()
<<
"Specified points number is too big"
;
points
.
clear
();
points
.
reserve
(
nPointsX
*
nPointsY
);
for
(
int
x
=
stepX
/
2
;
x
<
width
;
x
+=
stepX
)
{
for
(
int
y
=
stepY
/
2
;
y
<
height
;
y
+=
stepY
)
{
Point2f
pt
(
x
,
y
);
points
.
push_back
(
pt
);
}
}
}
PERF_TEST_P
(
Path_Idx_Cn_NPoints_WSize
,
OpticalFlowPyrLK
,
testing
::
Combine
(
testing
::
Values
<
std
::
string
>
(
"cv/optflow/frames/VGA_%02d.png"
,
"cv/optflow/frames/720p_%02d.jpg"
),
testing
::
Range
(
0
,
3
),
testing
::
Values
(
1
,
3
,
4
),
testing
::
Values
(
make_tuple
(
9
,
9
),
make_tuple
(
15
,
15
)),
testing
::
Values
(
11
,
21
,
25
)
)
)
{
string
filename1
=
getDataPath
(
cv
::
format
(
get
<
0
>
(
GetParam
()).
c_str
(),
get
<
1
>
(
GetParam
())));
string
filename2
=
getDataPath
(
cv
::
format
(
get
<
0
>
(
GetParam
()).
c_str
(),
get
<
1
>
(
GetParam
())
+
1
));
Mat
img1
=
imread
(
filename1
);
Mat
img2
=
imread
(
filename2
);
if
(
img1
.
empty
())
FAIL
()
<<
"Unable to load source image "
<<
filename1
;
if
(
img2
.
empty
())
FAIL
()
<<
"Unable to load source image "
<<
filename2
;
int
cn
=
get
<
2
>
(
GetParam
());
int
nPointsX
=
min
(
get
<
0
>
(
get
<
3
>
(
GetParam
())),
img1
.
cols
);
int
nPointsY
=
min
(
get
<
1
>
(
get
<
3
>
(
GetParam
())),
img1
.
rows
);
int
winSize
=
get
<
4
>
(
GetParam
());
int
maxLevel
=
2
;
TermCriteria
criteria
(
CV_TERMCRIT_ITER
|
CV_TERMCRIT_EPS
,
5
,
0.01
);
int
flags
=
0
;
double
minEigThreshold
=
1e-4
;
Mat
frame1
,
frame2
;
switch
(
cn
)
{
case
1
:
cvtColor
(
img1
,
frame1
,
COLOR_BGR2GRAY
,
cn
);
cvtColor
(
img2
,
frame2
,
COLOR_BGR2GRAY
,
cn
);
break
;
case
3
:
frame1
=
img1
;
frame2
=
img2
;
break
;
case
4
:
cvtColor
(
img1
,
frame1
,
COLOR_BGR2BGRA
,
cn
);
cvtColor
(
img2
,
frame2
,
COLOR_BGR2BGRA
,
cn
);
break
;
default
:
FAIL
()
<<
"Unexpected number of channels: "
<<
cn
;
}
vector
<
Point2f
>
inPoints
;
vector
<
Point2f
>
outPoints
;
vector
<
uchar
>
status
;
vector
<
float
>
err
;
FormTrackingPointsArray
(
inPoints
,
frame1
.
cols
,
frame1
.
rows
,
nPointsX
,
nPointsY
);
outPoints
.
resize
(
inPoints
.
size
());
status
.
resize
(
inPoints
.
size
());
err
.
resize
(
inPoints
.
size
());
declare
.
in
(
frame1
,
frame2
,
inPoints
).
out
(
outPoints
);
TEST_CYCLE_N
(
30
)
{
calcOpticalFlowPyrLK
(
frame1
,
frame2
,
inPoints
,
outPoints
,
status
,
err
,
Size
(
winSize
,
winSize
),
maxLevel
,
criteria
,
flags
,
minEigThreshold
);
}
}
modules/video/perf/perf_precomp.cpp
0 → 100644
View file @
d8cec20e
#include "perf_precomp.hpp"
modules/video/perf/perf_precomp.hpp
0 → 100644
View file @
d8cec20e
#ifndef __OPENCV_VIDEO_PRECOMP_HPP__
#define __OPENCV_VIDEO_PRECOMP_HPP__
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/video.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/ts/ts.hpp"
#if GTEST_CREATE_SHARED_LIBRARY
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
#endif
#endif
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