fixing other white spaces
This commit is contained in:
parent
582d5558cc
commit
a34f7b7714
@ -403,5 +403,7 @@ extlinks = {
|
||||
'cascade_classifier_load' : ('http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html?highlight=load#cascadeclassifier-load%s', None ),
|
||||
'cascade_classifier_detect_multiscale' : ('http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html?highlight=detectmultiscale#cascadeclassifier-detectmultiscale%s', None ),
|
||||
'background_subtractor' : ('http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html?highlight=backgroundsubtractor#backgroundsubtractor%s', None),
|
||||
'background_subtractor_mog' : ('http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html?highlight=backgroundsubtractorMOG#backgroundsubtractormog%s', None),
|
||||
'background_subtractor_mog_two' : ('http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html?highlight=backgroundsubtractorMOG2#backgroundsubtractormog2%s', None),
|
||||
'video_capture' : ('http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=videocapture#videocapture%s', None)
|
||||
}
|
||||
|
@ -36,15 +36,15 @@ 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:
|
||||
#. MOG
|
||||
#. MOG2
|
||||
#. :background_subtractor_mog:`MOG <>`
|
||||
#. :background_subtractor_mog_two:`MOG2 <>`
|
||||
|
||||
The results as well as the input data are shown on the screen.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
//opencv
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/highgui/highgui_c.h>
|
||||
#include <opencv2/video/background_segm.hpp>
|
||||
//C
|
||||
#include <stdio.h>
|
||||
@ -146,10 +146,10 @@ The results as well as the input data are shown on the screen.
|
||||
stringstream ss;
|
||||
rectangle(frame, cv::Point(10, 2), cv::Point(100,20),
|
||||
cv::Scalar(255,255,255), -1);
|
||||
ss << capture.get(CV_CAP_PROP_POS_FRAMES);
|
||||
ss << capture.get(CAP_PROP_POS_FRAMES);
|
||||
string frameNumberString = ss.str();
|
||||
putText(frame, frameNumberString.c_str(), cv::Point(15, 15),
|
||||
CV_FONT_NORMAL, 0.5 , cv::Scalar(0,0,0));
|
||||
FONT_HERSHEY_SIMPLEX, 0.5 , cv::Scalar(0,0,0));
|
||||
//show the current frame and the fg masks
|
||||
imshow("Frame", frame);
|
||||
imshow("FG Mask MOG", fgMaskMOG);
|
||||
@ -191,7 +191,7 @@ The results as well as the input data are shown on the screen.
|
||||
rectangle(frame, cv::Point(10, 2), cv::Point(100,20),
|
||||
cv::Scalar(255,255,255), -1);
|
||||
putText(frame, frameNumberString.c_str(), cv::Point(15, 15),
|
||||
CV_FONT_NORMAL, 0.5 , cv::Scalar(0,0,0));
|
||||
FONT_HERSHEY_SIMPLEX, 0.5 , cv::Scalar(0,0,0));
|
||||
//show the current frame and the fg masks
|
||||
imshow("Frame", frame);
|
||||
imshow("FG Mask MOG", fgMaskMOG);
|
||||
@ -286,10 +286,10 @@ We discuss the main parts of the above code:
|
||||
stringstream ss;
|
||||
rectangle(frame, cv::Point(10, 2), cv::Point(100,20),
|
||||
cv::Scalar(255,255,255), -1);
|
||||
ss << capture.get(CV_CAP_PROP_POS_FRAMES);
|
||||
ss << capture.get(CAP_PROP_POS_FRAMES);
|
||||
string frameNumberString = ss.str();
|
||||
putText(frame, frameNumberString.c_str(), cv::Point(15, 15),
|
||||
CV_FONT_NORMAL, 0.5 , cv::Scalar(0,0,0));
|
||||
FONT_HERSHEY_SIMPLEX, 0.5 , cv::Scalar(0,0,0));
|
||||
|
||||
#. We are ready to show the current input frame and the results.
|
||||
|
||||
@ -347,9 +347,8 @@ Results
|
||||
:alt: Background Subtraction - Video File
|
||||
:align: center
|
||||
|
||||
* The video file Video_001.avi is part of the `Background Models Challenge (BMC) <http://bmc.univ-bpclermont.fr/>`_ data set and it can be downloaded from `here <http://bmc.univ-bpclermont.fr/sites/default/files/videos/evaluation/Video_001.zip>`_.
|
||||
|
||||
|
||||
* The video file Video_001.avi is part of the `Background Models Challenge (BMC) <http://bmc.univ-bpclermont.fr/>`_ data set and it can be downloaded from the following link `Video_001 <http://bmc.univ-bpclermont.fr/sites/default/files/videos/evaluation/Video_001.zip>`_ (about 32 MB).
|
||||
|
||||
* If you want to process a sequence of images, then the '-img' option has to be chosen:
|
||||
|
||||
.. code-block:: cpp
|
||||
@ -362,7 +361,7 @@ Results
|
||||
:alt: Background Subtraction - Image Sequence
|
||||
:align: center
|
||||
|
||||
* The sequence of images used in this example is part of the `Background Models Challenge (BMC) <http://bmc.univ-bpclermont.fr/>`_ dataset and it can be downloaded from `here <http://bmc.univ-bpclermont.fr/sites/default/files/videos/learning/111_png.zip>`_. Please, note that this example works only on sequences in which the filename format is <n>.png, where n is the frame number (e.g., 7.png).
|
||||
* The sequence of images used in this example is part of the `Background Models Challenge (BMC) <http://bmc.univ-bpclermont.fr/>`_ dataset and it can be downloaded from the following link `sequence 111 <http://bmc.univ-bpclermont.fr/sites/default/files/videos/learning/111_png.zip>`_ (about 708 MB). Please, note that this example works only on sequences in which the filename format is <n>.png, where n is the frame number (e.g., 7.png).
|
||||
|
||||
Evaluation
|
||||
==========
|
||||
|
@ -1,6 +1,11 @@
|
||||
/**
|
||||
* @file bg_sub.cpp
|
||||
* @brief Background subtraction tutorial sample code
|
||||
* @author Domenico D. Bloisi
|
||||
*/
|
||||
|
||||
//opencv
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/highgui/highgui_c.h>
|
||||
#include <opencv2/video/background_segm.hpp>
|
||||
//C
|
||||
#include <stdio.h>
|
||||
@ -11,7 +16,7 @@
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
//global variables
|
||||
// Global variables
|
||||
Mat frame; //current frame
|
||||
Mat fgMaskMOG; //fg mask generated by MOG method
|
||||
Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method
|
||||
@ -19,7 +24,7 @@ Ptr<BackgroundSubtractor> pMOG; //MOG Background subtractor
|
||||
Ptr<BackgroundSubtractor> pMOG2; //MOG2 Background subtractor
|
||||
int keyboard; //input from keyboard
|
||||
|
||||
//function declarations
|
||||
/** Function Headers */
|
||||
void help();
|
||||
void processVideo(char* videoFilename);
|
||||
void processImages(char* firstFrameFilename);
|
||||
@ -39,6 +44,9 @@ void help()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @function main
|
||||
*/
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
//print help information
|
||||
@ -79,6 +87,9 @@ int main(int argc, char* argv[])
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @function processVideo
|
||||
*/
|
||||
void processVideo(char* videoFilename) {
|
||||
//create the capture object
|
||||
VideoCapture capture(videoFilename);
|
||||
@ -101,11 +112,11 @@ void processVideo(char* videoFilename) {
|
||||
//get the frame number and write it on the current frame
|
||||
stringstream ss;
|
||||
rectangle(frame, cv::Point(10, 2), cv::Point(100,20),
|
||||
cv::Scalar(255,255,255), -1);
|
||||
ss << capture.get(CV_CAP_PROP_POS_FRAMES);
|
||||
string frameNumberString = ss.str();
|
||||
putText(frame, frameNumberString.c_str(), cv::Point(15, 15),
|
||||
CV_FONT_NORMAL, 0.5 , cv::Scalar(0,0,0));
|
||||
cv::Scalar(255,255,255), -1);
|
||||
ss << capture.get(CAP_PROP_POS_FRAMES);
|
||||
string frameNumberString = ss.str();
|
||||
putText(frame, frameNumberString.c_str(), cv::Point(15, 15),
|
||||
FONT_HERSHEY_SIMPLEX, 0.5 , cv::Scalar(0,0,0));
|
||||
//show the current frame and the fg masks
|
||||
imshow("Frame", frame);
|
||||
imshow("FG Mask MOG", fgMaskMOG);
|
||||
@ -117,6 +128,9 @@ void processVideo(char* videoFilename) {
|
||||
capture.release();
|
||||
}
|
||||
|
||||
/**
|
||||
* @function processImages
|
||||
*/
|
||||
void processImages(char* fistFrameFilename) {
|
||||
//read the first file of the sequence
|
||||
frame = imread(fistFrameFilename);
|
||||
@ -145,9 +159,9 @@ void processImages(char* fistFrameFilename) {
|
||||
int frameNumber;
|
||||
iss >> frameNumber;
|
||||
rectangle(frame, cv::Point(10, 2), cv::Point(100,20),
|
||||
cv::Scalar(255,255,255), -1);
|
||||
cv::Scalar(255,255,255), -1);
|
||||
putText(frame, frameNumberString.c_str(), cv::Point(15, 15),
|
||||
CV_FONT_NORMAL, 0.5 , cv::Scalar(0,0,0));
|
||||
FONT_HERSHEY_SIMPLEX, 0.5 , cv::Scalar(0,0,0));
|
||||
//show the current frame and the fg masks
|
||||
imshow("Frame", frame);
|
||||
imshow("FG Mask MOG", fgMaskMOG);
|
||||
|
Loading…
Reference in New Issue
Block a user