Skip to content

Commit dc88a2b

Browse files
committed
video: clean up bg subtraction tutorial
1 parent b1ed8bc commit dc88a2b

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

doc/tutorials/video/background_subtraction/background_subtraction.markdown

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ Code
4040
In the following you can find the source code. We will let the user chose to process either a video
4141
file or a sequence of images.
4242

43-
Two different methods are used to generate two foreground masks:
44-
-# cv::bgsegm::BackgroundSubtractorMOG
45-
-# @ref cv::BackgroundSubtractorMOG2
43+
We will use @ref cv::BackgroundSubtractorMOG2 in this sample, to generate the foreground mask.
4644

4745
The results as well as the input data are shown on the screen.
4846
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
5452

5553
We discuss the main parts of the above code:
5654

57-
-# First, three Mat objects are allocated to store the current frame and two foreground masks,
55+
-# First, two Mat objects are allocated to store the current frame and two foreground masks,
5856
obtained by using two different BS algorithms.
5957
@code{.cpp}
6058
Mat frame; //current frame
61-
Mat fgMaskMOG; //fg mask generated by MOG method
6259
Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method
6360
@endcode
64-
-# Two @ref cv::BackgroundSubtractor objects will be used to generate the foreground masks. In this
61+
-# A @ref cv::BackgroundSubtractor object will be used to generate the foreground mask. In this
6562
example, default parameters are used, but it is also possible to declare specific parameters in
6663
the create function.
6764
@code{.cpp}
68-
Ptr<BackgroundSubtractor> pMOG; //MOG Background subtractor
6965
Ptr<BackgroundSubtractor> pMOG2; //MOG2 Background subtractor
7066
...
71-
//create Background Subtractor objects
72-
pMOG = createBackgroundSubtractorMOG(); //MOG approach
67+
//create Background Subtractor object
7368
pMOG2 = createBackgroundSubtractorMOG2(); //MOG2 approach
7469
@endcode
7570
-# 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:
10196
set a specific learning rate by passing a third parameter to the 'apply' method.
10297
@code{.cpp}
10398
//update the background model
104-
pMOG->apply(frame, fgMaskMOG);
10599
pMOG2->apply(frame, fgMaskMOG2);
106100
@endcode
107101
-# 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:
121115
@code{.cpp}
122116
//show the current frame and the fg masks
123117
imshow("Frame", frame);
124-
imshow("FG Mask MOG", fgMaskMOG);
125118
imshow("FG Mask MOG 2", fgMaskMOG2);
126119
@endcode
127120
-# The same operations listed above can be performed using a sequence of images as input. The
-57.6 KB
Loading
-65 KB
Loading

0 commit comments

Comments
 (0)