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
c5c620ba
Commit
c5c620ba
authored
Jan 21, 2018
by
Glue Crow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ocl: Avoid unnecessary initializing when non-UMat parameters are used
parent
d84c7e51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
bgfg_gaussmix2.cpp
modules/video/src/bgfg_gaussmix2.cpp
+11
-6
No files found.
modules/video/src/bgfg_gaussmix2.cpp
View file @
c5c620ba
...
...
@@ -770,6 +770,11 @@ public:
bool
BackgroundSubtractorMOG2Impl
::
ocl_apply
(
InputArray
_image
,
OutputArray
_fgmask
,
double
learningRate
)
{
bool
needToInitialize
=
nframes
==
0
||
learningRate
>=
1
||
_image
.
size
()
!=
frameSize
||
_image
.
type
()
!=
frameType
;
if
(
needToInitialize
)
initialize
(
_image
.
size
(),
_image
.
type
());
++
nframes
;
learningRate
=
learningRate
>=
0
&&
nframes
>
1
?
learningRate
:
1.
/
std
::
min
(
2
*
nframes
,
history
);
CV_Assert
(
learningRate
>=
0
);
...
...
@@ -841,21 +846,21 @@ void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask,
{
CV_INSTRUMENT_REGION
()
bool
needToInitialize
=
nframes
==
0
||
learningRate
>=
1
||
_image
.
size
()
!=
frameSize
||
_image
.
type
()
!=
frameType
;
if
(
needToInitialize
)
initialize
(
_image
.
size
(),
_image
.
type
());
#ifdef HAVE_OPENCL
if
(
opencl_ON
)
{
CV_OCL_RUN
(
_fgmask
.
isUMat
(),
ocl_apply
(
_image
,
_fgmask
,
learningRate
))
opencl_ON
=
false
;
initialize
(
_image
.
size
(),
_image
.
type
())
;
nframes
=
0
;
}
#endif
bool
needToInitialize
=
nframes
==
0
||
learningRate
>=
1
||
_image
.
size
()
!=
frameSize
||
_image
.
type
()
!=
frameType
;
if
(
needToInitialize
)
initialize
(
_image
.
size
(),
_image
.
type
());
Mat
image
=
_image
.
getMat
();
_fgmask
.
create
(
image
.
size
(),
CV_8U
);
Mat
fgmask
=
_fgmask
.
getMat
();
...
...
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