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
f9c61234
Commit
f9c61234
authored
Sep 13, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Sep 13, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1444 from ilya-lavrenov:ocl_test_mog
parents
e3710488
9311f841
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
perf_bgfg.cpp
modules/ocl/perf/perf_bgfg.cpp
+19
-12
test_bgfg.cpp
modules/ocl/test/test_bgfg.cpp
+16
-1
No files found.
modules/ocl/perf/perf_bgfg.cpp
View file @
f9c61234
...
@@ -44,12 +44,14 @@
...
@@ -44,12 +44,14 @@
//
//
//M*/
//M*/
#include "perf_precomp.hpp"
#include "perf_precomp.hpp"
using
namespace
perf
;
using
namespace
perf
;
using
namespace
std
;
using
namespace
std
;
using
namespace
cv
::
ocl
;
using
namespace
cv
::
ocl
;
using
namespace
cv
;
using
namespace
cv
;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
tuple
;
using
std
::
tr1
::
get
;
using
std
::
tr1
::
get
;
#if defined(HAVE_XINE) || \
#if defined(HAVE_XINE) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_QUICKTIME) || \
...
@@ -63,6 +65,7 @@ using std::tr1::get;
...
@@ -63,6 +65,7 @@ using std::tr1::get;
#endif
#endif
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
static
void
cvtFrameFmt
(
vector
<
Mat
>&
input
,
vector
<
Mat
>&
output
)
static
void
cvtFrameFmt
(
vector
<
Mat
>&
input
,
vector
<
Mat
>&
output
)
{
{
for
(
int
i
=
0
;
i
<
(
int
)(
input
.
size
());
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)(
input
.
size
());
i
++
)
...
@@ -70,6 +73,7 @@ static void cvtFrameFmt(vector<Mat>& input, vector<Mat>& output)
...
@@ -70,6 +73,7 @@ static void cvtFrameFmt(vector<Mat>& input, vector<Mat>& output)
cvtColor
(
input
[
i
],
output
[
i
],
COLOR_RGB2GRAY
);
cvtColor
(
input
[
i
],
output
[
i
],
COLOR_RGB2GRAY
);
}
}
}
}
//prepare data for CPU
//prepare data for CPU
static
void
prepareData
(
VideoCapture
&
cap
,
int
cn
,
vector
<
Mat
>&
frame_buffer
)
static
void
prepareData
(
VideoCapture
&
cap
,
int
cn
,
vector
<
Mat
>&
frame_buffer
)
{
{
...
@@ -88,15 +92,15 @@ static void prepareData(VideoCapture& cap, int cn, vector<Mat>& frame_buffer)
...
@@ -88,15 +92,15 @@ static void prepareData(VideoCapture& cap, int cn, vector<Mat>& frame_buffer)
else
else
frame_buffer
=
frame_buffer_init
;
frame_buffer
=
frame_buffer_init
;
}
}
//copy CPU data to GPU
//copy CPU data to GPU
static
void
prepareData
(
vector
<
Mat
>&
frame_buffer
,
vector
<
oclMat
>&
frame_buffer_ocl
)
static
void
prepareData
(
vector
<
Mat
>&
frame_buffer
,
vector
<
oclMat
>&
frame_buffer_ocl
)
{
{
for
(
int
i
=
0
;
i
<
(
int
)
frame_buffer
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
frame_buffer
.
size
();
i
++
)
frame_buffer_ocl
.
push_back
(
cv
::
ocl
::
oclMat
(
frame_buffer
[
i
]));
frame_buffer_ocl
.
push_back
(
cv
::
ocl
::
oclMat
(
frame_buffer
[
i
]));
}
}
#endif
///////////// MOG ////////////////////////
///////////// MOG ////////////////////////
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
typedef
tuple
<
string
,
int
,
double
>
VideoMOGParamType
;
typedef
tuple
<
string
,
int
,
double
>
VideoMOGParamType
;
typedef
TestBaseWithParam
<
VideoMOGParamType
>
VideoMOGFixture
;
typedef
TestBaseWithParam
<
VideoMOGParamType
>
VideoMOGFixture
;
...
@@ -137,7 +141,8 @@ PERF_TEST_P(VideoMOGFixture, MOG,
...
@@ -137,7 +141,8 @@ PERF_TEST_P(VideoMOGFixture, MOG,
}
}
}
}
SANITY_CHECK
(
foreground
);
SANITY_CHECK
(
foreground
);
}
else
if
(
RUN_OCL_IMPL
)
}
else
if
(
RUN_OCL_IMPL
)
{
{
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
...
@@ -152,13 +157,12 @@ PERF_TEST_P(VideoMOGFixture, MOG,
...
@@ -152,13 +157,12 @@ PERF_TEST_P(VideoMOGFixture, MOG,
}
}
foreground_d
.
download
(
foreground
);
foreground_d
.
download
(
foreground
);
SANITY_CHECK
(
foreground
);
SANITY_CHECK
(
foreground
);
}
else
}
else
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
#endif
///////////// MOG2 ////////////////////////
///////////// MOG2 ////////////////////////
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
typedef
tuple
<
string
,
int
>
VideoMOG2ParamType
;
typedef
tuple
<
string
,
int
>
VideoMOG2ParamType
;
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
VideoMOG2Fixture
;
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
VideoMOG2Fixture
;
...
@@ -196,7 +200,8 @@ PERF_TEST_P(VideoMOG2Fixture, MOG2,
...
@@ -196,7 +200,8 @@ PERF_TEST_P(VideoMOG2Fixture, MOG2,
}
}
}
}
SANITY_CHECK
(
foreground
);
SANITY_CHECK
(
foreground
);
}
else
if
(
RUN_OCL_IMPL
)
}
else
if
(
RUN_OCL_IMPL
)
{
{
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
...
@@ -211,13 +216,12 @@ PERF_TEST_P(VideoMOG2Fixture, MOG2,
...
@@ -211,13 +216,12 @@ PERF_TEST_P(VideoMOG2Fixture, MOG2,
}
}
foreground_d
.
download
(
foreground
);
foreground_d
.
download
(
foreground
);
SANITY_CHECK
(
foreground
);
SANITY_CHECK
(
foreground
);
}
else
}
else
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
#endif
///////////// MOG2_GetBackgroundImage //////////////////
///////////// MOG2_GetBackgroundImage //////////////////
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
Video_MOG2GetBackgroundImage
;
typedef
TestBaseWithParam
<
VideoMOG2ParamType
>
Video_MOG2GetBackgroundImage
;
...
@@ -259,7 +263,8 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
...
@@ -259,7 +263,8 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
mog2
.
getBackgroundImage
(
background
);
mog2
.
getBackgroundImage
(
background
);
}
}
SANITY_CHECK
(
background
);
SANITY_CHECK
(
background
);
}
else
if
(
RUN_OCL_IMPL
)
}
else
if
(
RUN_OCL_IMPL
)
{
{
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
prepareData
(
frame_buffer
,
frame_buffer_ocl
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
CV_Assert
((
int
)(
frame_buffer_ocl
.
size
())
==
nFrame
);
...
@@ -276,7 +281,9 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
...
@@ -276,7 +281,9 @@ PERF_TEST_P(Video_MOG2GetBackgroundImage, MOG2,
}
}
background_d
.
download
(
background
);
background_d
.
download
(
background
);
SANITY_CHECK
(
background
);
SANITY_CHECK
(
background
);
}
else
}
else
OCL_PERF_ELSE
OCL_PERF_ELSE
}
}
#endif
#endif
modules/ocl/test/test_bgfg.cpp
View file @
f9c61234
...
@@ -53,7 +53,20 @@ using namespace cvtest;
...
@@ -53,7 +53,20 @@ using namespace cvtest;
using
namespace
testing
;
using
namespace
testing
;
using
namespace
std
;
using
namespace
std
;
extern
string
workdir
;
#if defined(HAVE_XINE) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_QUICKTIME) || \
defined(HAVE_AVFOUNDATION) || \
defined(HAVE_FFMPEG) || \
defined(WIN32)
# define BUILD_WITH_VIDEO_INPUT_SUPPORT 1
#else
# define BUILD_WITH_VIDEO_INPUT_SUPPORT 0
#endif
#if BUILD_WITH_VIDEO_INPUT_SUPPORT
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// MOG
// MOG
...
@@ -225,3 +238,5 @@ INSTANTIATE_TEST_CASE_P(OCL_Video, mog2, testing::Combine(
...
@@ -225,3 +238,5 @@ INSTANTIATE_TEST_CASE_P(OCL_Video, mog2, testing::Combine(
Values
(
true
,
false
)));
Values
(
true
,
false
)));
#endif
#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