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
87db636c
Commit
87db636c
authored
Jan 21, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10657 from GlueCrow:mog2_init_fix
parents
d84c7e51
c5c620ba
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 @
87db636c
...
@@ -770,6 +770,11 @@ public:
...
@@ -770,6 +770,11 @@ public:
bool
BackgroundSubtractorMOG2Impl
::
ocl_apply
(
InputArray
_image
,
OutputArray
_fgmask
,
double
learningRate
)
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
;
++
nframes
;
learningRate
=
learningRate
>=
0
&&
nframes
>
1
?
learningRate
:
1.
/
std
::
min
(
2
*
nframes
,
history
);
learningRate
=
learningRate
>=
0
&&
nframes
>
1
?
learningRate
:
1.
/
std
::
min
(
2
*
nframes
,
history
);
CV_Assert
(
learningRate
>=
0
);
CV_Assert
(
learningRate
>=
0
);
...
@@ -841,21 +846,21 @@ void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask,
...
@@ -841,21 +846,21 @@ void BackgroundSubtractorMOG2Impl::apply(InputArray _image, OutputArray _fgmask,
{
{
CV_INSTRUMENT_REGION
()
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
#ifdef HAVE_OPENCL
if
(
opencl_ON
)
if
(
opencl_ON
)
{
{
CV_OCL_RUN
(
_fgmask
.
isUMat
(),
ocl_apply
(
_image
,
_fgmask
,
learningRate
))
CV_OCL_RUN
(
_fgmask
.
isUMat
(),
ocl_apply
(
_image
,
_fgmask
,
learningRate
))
opencl_ON
=
false
;
opencl_ON
=
false
;
initialize
(
_image
.
size
(),
_image
.
type
())
;
nframes
=
0
;
}
}
#endif
#endif
bool
needToInitialize
=
nframes
==
0
||
learningRate
>=
1
||
_image
.
size
()
!=
frameSize
||
_image
.
type
()
!=
frameType
;
if
(
needToInitialize
)
initialize
(
_image
.
size
(),
_image
.
type
());
Mat
image
=
_image
.
getMat
();
Mat
image
=
_image
.
getMat
();
_fgmask
.
create
(
image
.
size
(),
CV_8U
);
_fgmask
.
create
(
image
.
size
(),
CV_8U
);
Mat
fgmask
=
_fgmask
.
getMat
();
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