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
41154b30
Commit
41154b30
authored
Nov 28, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Nov 28, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1885 from jet47:gpu-bgfg-test-fix
parents
70c1b700
7537521f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
233 additions
and
17 deletions
+233
-17
perf_video.cpp
modules/gpu/perf/perf_video.cpp
+233
-17
No files found.
modules/gpu/perf/perf_video.cpp
View file @
41154b30
...
...
@@ -544,6 +544,8 @@ DEF_PARAM_TEST_1(Video, string);
PERF_TEST_P
(
Video
,
Video_FGDStatModel
,
Values
(
string
(
"gpu/video/768x576.avi"
)))
{
const
int
numIters
=
10
;
declare
.
time
(
60
);
const
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
GetParam
());
...
...
@@ -562,18 +564,36 @@ PERF_TEST_P(Video, Video_FGDStatModel,
cv
::
gpu
::
FGDStatModel
d_model
(
4
);
d_model
.
create
(
d_frame
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
d_frame
.
upload
(
frame
);
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
d_model
.
update
(
d_frame
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
d_frame
.
upload
(
frame
);
d_model
.
update
(
d_frame
);
}
const
cv
::
gpu
::
GpuMat
background
=
d_model
.
background
;
const
cv
::
gpu
::
GpuMat
foreground
=
d_model
.
foreground
;
...
...
@@ -585,18 +605,36 @@ PERF_TEST_P(Video, Video_FGDStatModel,
IplImage
ipl_frame
=
frame
;
cv
::
Ptr
<
CvBGStatModel
>
model
(
cvCreateFGDStatModel
(
&
ipl_frame
));
for
(
int
i
=
0
;
i
<
10
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
ipl_frame
=
frame
;
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
cvUpdateBGStatModel
(
&
ipl_frame
,
model
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
ipl_frame
=
frame
;
cvUpdateBGStatModel
(
&
ipl_frame
,
model
);
}
const
cv
::
Mat
background
=
model
->
background
;
const
cv
::
Mat
foreground
=
model
->
foreground
;
...
...
@@ -619,6 +657,8 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG,
GPU_CHANNELS_1_3_4
,
Values
(
0.0
,
0.01
)))
{
const
int
numIters
=
10
;
const
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
GET_PARAM
(
0
));
const
int
cn
=
GET_PARAM
(
1
);
const
float
learningRate
=
static_cast
<
float
>
(
GET_PARAM
(
2
));
...
...
@@ -649,7 +689,10 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG,
d_mog
(
d_frame
,
foreground
,
learningRate
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
...
...
@@ -666,11 +709,36 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG,
d_frame
.
upload
(
frame
);
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
d_mog
(
d_frame
,
foreground
,
learningRate
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
if
(
cn
!=
3
)
{
cv
::
Mat
temp
;
if
(
cn
==
1
)
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2GRAY
);
else
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2BGRA
);
cv
::
swap
(
temp
,
frame
);
}
d_frame
.
upload
(
frame
);
d_mog
(
d_frame
,
foreground
,
learningRate
);
}
GPU_SANITY_CHECK
(
foreground
);
}
else
...
...
@@ -680,7 +748,10 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG,
mog
(
frame
,
foreground
,
learningRate
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
...
...
@@ -695,11 +766,34 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG,
cv
::
swap
(
temp
,
frame
);
}
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
mog
(
frame
,
foreground
,
learningRate
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
if
(
cn
!=
3
)
{
cv
::
Mat
temp
;
if
(
cn
==
1
)
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2GRAY
);
else
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2BGRA
);
cv
::
swap
(
temp
,
frame
);
}
mog
(
frame
,
foreground
,
learningRate
);
}
CPU_SANITY_CHECK
(
foreground
);
}
}
...
...
@@ -713,10 +807,12 @@ PERF_TEST_P(Video_Cn_LearningRate, Video_MOG,
DEF_PARAM_TEST
(
Video_Cn
,
string
,
int
);
PERF_TEST_P
(
Video_Cn
,
Video_MOG2
,
PERF_TEST_P
(
Video_Cn
,
DISABLED_
Video_MOG2
,
Combine
(
Values
(
"gpu/video/768x576.avi"
,
"gpu/video/1920x1080.avi"
),
GPU_CHANNELS_1_3_4
))
{
const
int
numIters
=
10
;
const
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
GET_PARAM
(
0
));
const
int
cn
=
GET_PARAM
(
1
);
...
...
@@ -748,7 +844,10 @@ PERF_TEST_P(Video_Cn, Video_MOG2,
d_mog2
(
d_frame
,
foreground
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
...
...
@@ -765,11 +864,36 @@ PERF_TEST_P(Video_Cn, Video_MOG2,
d_frame
.
upload
(
frame
);
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
d_mog2
(
d_frame
,
foreground
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
if
(
cn
!=
3
)
{
cv
::
Mat
temp
;
if
(
cn
==
1
)
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2GRAY
);
else
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2BGRA
);
cv
::
swap
(
temp
,
frame
);
}
d_frame
.
upload
(
frame
);
d_mog2
(
d_frame
,
foreground
);
}
GPU_SANITY_CHECK
(
foreground
);
}
else
...
...
@@ -781,7 +905,10 @@ PERF_TEST_P(Video_Cn, Video_MOG2,
mog2
(
frame
,
foreground
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
...
...
@@ -796,11 +923,34 @@ PERF_TEST_P(Video_Cn, Video_MOG2,
cv
::
swap
(
temp
,
frame
);
}
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
mog2
(
frame
,
foreground
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
ASSERT_FALSE
(
frame
.
empty
());
if
(
cn
!=
3
)
{
cv
::
Mat
temp
;
if
(
cn
==
1
)
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2GRAY
);
else
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2BGRA
);
cv
::
swap
(
temp
,
frame
);
}
mog2
(
frame
,
foreground
);
}
CPU_SANITY_CHECK
(
foreground
);
}
}
...
...
@@ -901,6 +1051,8 @@ PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG,
GPU_CHANNELS_1_3_4
,
Values
(
20
,
40
,
60
)))
{
const
int
numIters
=
150
;
const
std
::
string
inputFile
=
perf
::
TestBase
::
getDataPath
(
GET_PARAM
(
0
));
const
int
cn
=
GET_PARAM
(
1
);
const
int
maxFeatures
=
GET_PARAM
(
2
);
...
...
@@ -932,7 +1084,10 @@ PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG,
d_gmg
(
d_frame
,
foreground
);
for
(
int
i
=
0
;
i
<
150
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
if
(
frame
.
empty
())
...
...
@@ -954,11 +1109,41 @@ PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG,
d_frame
.
upload
(
frame
);
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
d_gmg
(
d_frame
,
foreground
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
if
(
frame
.
empty
())
{
cap
.
release
();
cap
.
open
(
inputFile
);
cap
>>
frame
;
}
if
(
cn
!=
3
)
{
cv
::
Mat
temp
;
if
(
cn
==
1
)
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2GRAY
);
else
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2BGRA
);
cv
::
swap
(
temp
,
frame
);
}
d_frame
.
upload
(
frame
);
d_gmg
(
d_frame
,
foreground
);
}
GPU_SANITY_CHECK
(
foreground
);
}
else
...
...
@@ -972,7 +1157,10 @@ PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG,
gmg
(
frame
,
foreground
);
for
(
int
i
=
0
;
i
<
150
;
++
i
)
int
i
=
0
;
// collect performance data
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
if
(
frame
.
empty
())
...
...
@@ -992,11 +1180,39 @@ PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG,
cv
::
swap
(
temp
,
frame
);
}
startTimer
();
next
();
startTimer
();
if
(
!
next
())
break
;
gmg
(
frame
,
foreground
);
stopTimer
();
}
// process last frame in sequence to get data for sanity test
for
(;
i
<
numIters
;
++
i
)
{
cap
>>
frame
;
if
(
frame
.
empty
())
{
cap
.
release
();
cap
.
open
(
inputFile
);
cap
>>
frame
;
}
if
(
cn
!=
3
)
{
cv
::
Mat
temp
;
if
(
cn
==
1
)
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2GRAY
);
else
cv
::
cvtColor
(
frame
,
temp
,
cv
::
COLOR_BGR2BGRA
);
cv
::
swap
(
temp
,
frame
);
}
gmg
(
frame
,
foreground
);
}
CPU_SANITY_CHECK
(
foreground
);
}
}
...
...
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