From a34f7b7714d88c13396891e03b27fdb289ad9335 Mon Sep 17 00:00:00 2001 From: dbloisi Date: Sun, 1 Sep 2013 19:05:07 +0200 Subject: [PATCH] fixing other white spaces --- doc/conf.py | 2 ++ .../background_subtraction.rst | 23 ++++++------- samples/cpp/tutorial_code/video/bg_sub.cpp | 34 +++++++++++++------ 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 715b47d41..29951b233 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -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) } diff --git a/doc/tutorials/video/background_subtraction/background_subtraction.rst b/doc/tutorials/video/background_subtraction/background_subtraction.rst index 02cbec245..94df3bbed 100644 --- a/doc/tutorials/video/background_subtraction/background_subtraction.rst +++ b/doc/tutorials/video/background_subtraction/background_subtraction.rst @@ -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 - #include #include //C #include @@ -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) `_ data set and it can be downloaded from `here `_. - - +* The video file Video_001.avi is part of the `Background Models Challenge (BMC) `_ data set and it can be downloaded from the following link `Video_001 `_ (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) `_ dataset and it can be downloaded from `here `_. Please, note that this example works only on sequences in which the filename format is .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) `_ dataset and it can be downloaded from the following link `sequence 111 `_ (about 708 MB). Please, note that this example works only on sequences in which the filename format is .png, where n is the frame number (e.g., 7.png). Evaluation ========== diff --git a/samples/cpp/tutorial_code/video/bg_sub.cpp b/samples/cpp/tutorial_code/video/bg_sub.cpp index 7d2375e44..e1911c58a 100644 --- a/samples/cpp/tutorial_code/video/bg_sub.cpp +++ b/samples/cpp/tutorial_code/video/bg_sub.cpp @@ -1,6 +1,11 @@ +/** + * @file bg_sub.cpp + * @brief Background subtraction tutorial sample code + * @author Domenico D. Bloisi + */ + //opencv #include -#include #include //C #include @@ -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 pMOG; //MOG Background subtractor Ptr 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);