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
68c57a1e
Commit
68c57a1e
authored
Mar 20, 2014
by
Roman Donchenko
Committed by
OpenCV Buildbot
Mar 20, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2473 from euphrat:mog2_weight_bugfix
parents
a1e5bd71
0a16d93e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
bgfg_mog.cu
modules/gpu/src/cuda/bgfg_mog.cu
+3
-2
bgfg_mog.cl
modules/ocl/src/opencl/bgfg_mog.cl
+3
-2
bgfg_gaussmix2.cpp
modules/video/src/bgfg_gaussmix2.cpp
+3
-2
No files found.
modules/gpu/src/cuda/bgfg_mog.cu
View file @
68c57a1e
...
...
@@ -489,7 +489,7 @@ namespace cv { namespace gpu { namespace device
{
//need only weight if fit is found
float weight = alpha1 * gmm_weight(mode * frame.rows + y, x) + prune;
int swap_count = 0;
//fit not found yet
if (!fitsPDF)
{
...
...
@@ -540,6 +540,7 @@ namespace cv { namespace gpu { namespace device
if (weight < gmm_weight((i - 1) * frame.rows + y, x))
break;
swap_count++;
//swap one up
swap(gmm_weight, x, y, i - 1, frame.rows);
swap(gmm_variance, x, y, i - 1, frame.rows);
...
...
@@ -557,7 +558,7 @@ namespace cv { namespace gpu { namespace device
nmodes--;
}
gmm_weight(
mode
* frame.rows + y, x) = weight; //update weight by the calculated value
gmm_weight(
(mode - swap_count)
* frame.rows + y, x) = weight; //update weight by the calculated value
totalWeight += weight;
}
...
...
modules/ocl/src/opencl/bgfg_mog.cl
View file @
68c57a1e
...
...
@@ -376,7 +376,7 @@ __kernel void mog2_kernel(__global T_FRAME * frame, __global int* fgmask, __glob
for
(
int
mode
=
0
; mode < nmodes; ++mode)
{
float
_weight
=
alpha1
*
weight[
(
mode
*
frame_row
+
y
)
*
weight_step
+
x]
+
prune
;
int
swap_count
=
0
;
if
(
!fitsPDF
)
{
float
var
=
variance[
(
mode
*
frame_row
+
y
)
*
var_step
+
x]
;
...
...
@@ -404,6 +404,7 @@ __kernel void mog2_kernel(__global T_FRAME * frame, __global int* fgmask, __glob
{
if
(
_weight
<
weight[
((
i
-
1
)
*
frame_row
+
y
)
*
weight_step
+
x]
)
break
;
swap_count++
;
swap
(
weight,
x,
y,
i
-
1
,
frame_row,
weight_step
)
;
swap
(
variance,
x,
y,
i
-
1
,
frame_row,
var_step
)
;
#
if
defined
(
CN1
)
...
...
@@ -421,7 +422,7 @@ __kernel void mog2_kernel(__global T_FRAME * frame, __global int* fgmask, __glob
nmodes--
;
}
weight[
(
mode
*
frame_row
+
y
)
*
weight_step
+
x]
=
_weight
; //update weight by the calculated value
weight[
(
(
mode
-
swap_count
)
*
frame_row
+
y
)
*
weight_step
+
x]
=
_weight
; //update weight by the calculated value
totalWeight
+=
_weight
;
}
...
...
modules/video/src/bgfg_gaussmix2.cpp
View file @
68c57a1e
...
...
@@ -319,7 +319,7 @@ struct MOG2Invoker : ParallelLoopBody
for
(
int
mode
=
0
;
mode
<
nmodes
;
mode
++
,
mean_m
+=
nchannels
)
{
float
weight
=
alpha1
*
gmm
[
mode
].
weight
+
prune
;
//need only weight if fit is found
int
swap_count
=
0
;
////
//fit not found yet
if
(
!
fitsPDF
)
...
...
@@ -384,6 +384,7 @@ struct MOG2Invoker : ParallelLoopBody
if
(
weight
<
gmm
[
i
-
1
].
weight
)
break
;
swap_count
++
;
//swap one up
std
::
swap
(
gmm
[
i
],
gmm
[
i
-
1
]);
for
(
int
c
=
0
;
c
<
nchannels
;
c
++
)
...
...
@@ -401,7 +402,7 @@ struct MOG2Invoker : ParallelLoopBody
nmodes
--
;
}
gmm
[
mode
].
weight
=
weight
;
//update weight by the calculated value
gmm
[
mode
-
swap_count
].
weight
=
weight
;
//update weight by the calculated value
totalWeight
+=
weight
;
}
//go through all modes
...
...
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