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
beb3e6ff
Commit
beb3e6ff
authored
Aug 09, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added GMG_GPU to bgfg_segm sample
parent
f7f1fb2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
bgfg_segm.cpp
samples/gpu/bgfg_segm.cpp
+21
-5
No files found.
samples/gpu/bgfg_segm.cpp
View file @
beb3e6ff
...
...
@@ -14,7 +14,8 @@ enum Method
FGD_STAT
,
MOG
,
MOG2
,
VIBE
VIBE
,
GMG
};
int
main
(
int
argc
,
const
char
**
argv
)
...
...
@@ -22,7 +23,7 @@ int main(int argc, const char** argv)
cv
::
CommandLineParser
cmd
(
argc
,
argv
,
"{ c | camera | false | use camera }"
"{ f | file | 768x576.avi | input video file }"
"{ m | method | mog | method (fgd
_stat, mog, mog2, vibe
) }"
"{ m | method | mog | method (fgd
, mog, mog2, vibe, gmg
) }"
"{ h | help | false | print help message }"
);
if
(
cmd
.
get
<
bool
>
(
"help"
))
...
...
@@ -37,13 +38,13 @@ int main(int argc, const char** argv)
string
file
=
cmd
.
get
<
string
>
(
"file"
);
string
method
=
cmd
.
get
<
string
>
(
"method"
);
if
(
method
!=
"fgd
_stat"
&&
method
!=
"mog"
&&
method
!=
"mog2"
&&
method
!=
"vibe
"
)
if
(
method
!=
"fgd
"
&&
method
!=
"mog"
&&
method
!=
"mog2"
&&
method
!=
"vibe"
&&
method
!=
"gmg
"
)
{
cerr
<<
"Incorrect method"
<<
endl
;
return
-
1
;
}
Method
m
=
method
==
"fgd
_stat"
?
FGD_STAT
:
method
==
"mog"
?
MOG
:
method
==
"mog2"
?
MOG2
:
VIBE
;
Method
m
=
method
==
"fgd
"
?
FGD_STAT
:
method
==
"mog"
?
MOG
:
method
==
"mog2"
?
MOG2
:
method
==
"vibe"
?
VIBE
:
GMG
;
VideoCapture
cap
;
...
...
@@ -67,6 +68,8 @@ int main(int argc, const char** argv)
MOG_GPU
mog
;
MOG2_GPU
mog2
;
VIBE_GPU
vibe
;
GMG_GPU
gmg
;
gmg
.
numInitializationFrames
=
40
;
GpuMat
d_fgmask
;
GpuMat
d_fgimg
;
...
...
@@ -93,12 +96,16 @@ int main(int argc, const char** argv)
case
VIBE
:
vibe
.
initialize
(
d_frame
);
break
;
case
GMG
:
gmg
.
initialize
(
d_frame
.
size
());
break
;
}
namedWindow
(
"image"
,
WINDOW_NORMAL
);
namedWindow
(
"foreground mask"
,
WINDOW_NORMAL
);
namedWindow
(
"foreground image"
,
WINDOW_NORMAL
);
if
(
m
!=
VIBE
)
if
(
m
!=
VIBE
&&
m
!=
GMG
)
namedWindow
(
"mean background image"
,
WINDOW_NORMAL
);
for
(;;)
...
...
@@ -108,6 +115,8 @@ int main(int argc, const char** argv)
break
;
d_frame
.
upload
(
frame
);
int64
start
=
cv
::
getTickCount
();
//update the model
switch
(
m
)
{
...
...
@@ -130,8 +139,15 @@ int main(int argc, const char** argv)
case
VIBE
:
vibe
(
d_frame
,
d_fgmask
);
break
;
case
GMG
:
gmg
(
d_frame
,
d_fgmask
);
break
;
}
double
fps
=
cv
::
getTickFrequency
()
/
(
cv
::
getTickCount
()
-
start
);
std
::
cout
<<
"FPS : "
<<
fps
<<
std
::
endl
;
d_fgimg
.
setTo
(
Scalar
::
all
(
0
));
d_frame
.
copyTo
(
d_fgimg
,
d_fgmask
);
...
...
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