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
dc88a2bc
Commit
dc88a2bc
authored
Dec 31, 2017
by
berak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video: clean up bg subtraction tutorial
parent
b1ed8bc0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
11 deletions
+4
-11
background_subtraction.markdown
...eo/background_subtraction/background_subtraction.markdown
+4
-11
Background_Subtraction_Tutorial_Result_1.png
...ction/images/Background_Subtraction_Tutorial_Result_1.png
+0
-0
Background_Subtraction_Tutorial_Result_2.png
...ction/images/Background_Subtraction_Tutorial_Result_2.png
+0
-0
No files found.
doc/tutorials/video/background_subtraction/background_subtraction.markdown
View file @
dc88a2bc
...
...
@@ -40,9 +40,7 @@ Code
In the following you can find the source code. We will let the user chose to process either a video
file or a sequence of images.
Two different methods are used to generate two foreground masks:
-# cv::bgsegm::BackgroundSubtractorMOG
-# @ref cv::BackgroundSubtractorMOG2
We will use @ref cv::BackgroundSubtractorMOG2 in this sample, to generate the foreground mask.
The results as well as the input data are shown on the screen.
The source file can be downloaded
[
here
](
https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code/video/bg_sub.cpp
)
.
...
...
@@ -54,22 +52,19 @@ Explanation
We discuss the main parts of the above code:
-# First, t
hree
Mat objects are allocated to store the current frame and two foreground masks,
-# First, t
wo
Mat objects are allocated to store the current frame and two foreground masks,
obtained by using two different BS algorithms.
@code{.cpp}
Mat frame; //current frame
Mat fgMaskMOG; //fg mask generated by MOG method
Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method
@endcode
-#
Two @ref cv::BackgroundSubtractor objects will be used to generate the foreground masks
. In this
-#
A @ref cv::BackgroundSubtractor object will be used to generate the foreground mask
. In this
example, default parameters are used, but it is also possible to declare specific parameters in
the create function.
@code{.cpp}
Ptr
<BackgroundSubtractor>
pMOG; //MOG Background subtractor
Ptr
<BackgroundSubtractor>
pMOG2; //MOG2 Background subtractor
...
//create Background Subtractor objects
pMOG = createBackgroundSubtractorMOG(); //MOG approach
//create Background Subtractor object
pMOG2 = createBackgroundSubtractorMOG2(); //MOG2 approach
@endcode
-# The command line arguments are analysed. The user can chose between two options:
...
...
@@ -101,7 +96,6 @@ We discuss the main parts of the above code:
set a specific learning rate by passing a third parameter to the 'apply' method.
@code{.cpp}
//update the background model
pMOG->apply(frame, fgMaskMOG);
pMOG2->apply(frame, fgMaskMOG2);
@endcode
-# The current frame number can be extracted from the @ref cv::VideoCapture object and stamped in
...
...
@@ -121,7 +115,6 @@ We discuss the main parts of the above code:
@code{.cpp}
//show the current frame and the fg masks
imshow("Frame", frame);
imshow("FG Mask MOG", fgMaskMOG);
imshow("FG Mask MOG 2", fgMaskMOG2);
@endcode
-# The same operations listed above can be performed using a sequence of images as input. The
...
...
doc/tutorials/video/background_subtraction/images/Background_Subtraction_Tutorial_Result_1.png
View replaced file @
b1ed8bc0
View file @
dc88a2bc
141 KB
|
W:
|
H:
83.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
doc/tutorials/video/background_subtraction/images/Background_Subtraction_Tutorial_Result_2.png
View replaced file @
b1ed8bc0
View file @
dc88a2bc
159 KB
|
W:
|
H:
93.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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