From 77cae11a749aaa1c88c250660dcb641b58c98a96 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 9 Aug 2012 13:28:28 +0400 Subject: [PATCH] added docs for GMG_GPU --- modules/gpu/doc/video.rst | 109 ++++++++++++++++++++++++++++++++ modules/gpu/include/opencv2/gpu/gpu.hpp | 14 ++-- 2 files changed, 116 insertions(+), 7 deletions(-) diff --git a/modules/gpu/doc/video.rst b/modules/gpu/doc/video.rst index bb312e0..378cca7 100644 --- a/modules/gpu/doc/video.rst +++ b/modules/gpu/doc/video.rst @@ -649,6 +649,114 @@ Releases all inner buffer's memory. +gpu::GMG_GPU +------------ +.. ocv:class:: gpu::GMG_GPU + +Class used for background/foreground segmentation. :: + + class GMG_GPU_GPU + { + public: + GMG_GPU(); + + void initialize(Size frameSize, float min = 0.0f, float max = 255.0f); + + void operator ()(const GpuMat& frame, GpuMat& fgmask, float learningRate = -1.0f, Stream& stream = Stream::Null()); + + void release(); + + int maxFeatures; + float learningRate; + int numInitializationFrames; + int quantizationLevels; + float backgroundPrior; + float decisionThreshold; + int smoothingRadius; + + ... + }; + +The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [GMG2012]_. + +Here are important members of the class that control the algorithm, which you can set after constructing the class instance: + + .. ocv:member:: int maxFeatures + + Total number of distinct colors to maintain in histogram. + + .. ocv:member:: float learningRate + + Set between 0.0 and 1.0, determines how quickly features are "forgotten" from histograms. + + .. ocv:member:: int numInitializationFrames + + Number of frames of video to use to initialize histograms. + + .. ocv:member:: int quantizationLevels + + Number of discrete levels in each channel to be used in histograms. + + .. ocv:member:: float backgroundPrior + + Prior probability that any given pixel is a background pixel. A sensitivity parameter. + + .. ocv:member:: float decisionThreshold + + Value above which pixel is determined to be FG. + + .. ocv:member:: float smoothingRadius + + Smoothing radius, in pixels, for cleaning up FG image. + + + +gpu::GMG_GPU::GMG_GPU +--------------------- +The default constructor. + +.. ocv:function:: gpu::GMG_GPU::GMG_GPU() + +Default constructor sets all parameters to default values. + + + +gpu::GMG_GPU::initialize +------------------------ +Initialize background model and allocates all inner buffers. + +.. ocv:function:: void gpu::GMG_GPU::initialize(Size frameSize, float min = 0.0f, float max = 255.0f) + + :param frameSize: Input frame size. + + :param min: Minimum value taken on by pixels in image sequence. Usually 0. + + :param max: Maximum value taken on by pixels in image sequence, e.g. 1.0 or 255. + + + +gpu::GMG_GPU::operator() +------------------------ +Updates the background model and returns the foreground mask + +.. ocv:function:: void gpu::GMG_GPU::operator()(const GpuMat& frame, GpuMat& fgmask, Stream& stream = Stream::Null()) + + :param frame: Next video frame. + + :param fgmask: The output foreground mask as an 8-bit binary image. + + :param stream: Stream for the asynchronous version. + + + +gpu::GMG_GPU::release +--------------------- +Releases all inner buffer's memory. + +.. ocv:function:: void gpu::GMG_GPU::release() + + + gpu::VideoWriter_GPU --------------------- Video writer class. @@ -1093,3 +1201,4 @@ Parse next video frame. Implementation must call this method after new frame was .. [MOG2004] Z. Zivkovic. *Improved adaptive Gausian mixture model for background subtraction*. International Conference Pattern Recognition, UK, August, 2004 .. [ShadowDetect2003] Prati, Mikic, Trivedi and Cucchiarra. *Detecting Moving Shadows...*. IEEE PAMI, 2003 .. [VIBE2011] O. Barnich and M. Van D Roogenbroeck. *ViBe: A universal background subtraction algorithm for video sequences*. IEEE Transactions on Image Processing, 20(6) :1709-1724, June 2011 +.. [GMG2012] A. Godbehere, A. Matsukawa and K. Goldberg. *Visual Tracking of Human Visitors under Variable-Lighting Conditions for a Responsive Audio Art Installation*. American Control Conference, Montreal, June 2012 diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp index 1524bec..c6b9371 100644 --- a/modules/gpu/include/opencv2/gpu/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu/gpu.hpp @@ -2160,25 +2160,25 @@ public: void release(); //! Total number of distinct colors to maintain in histogram. - int maxFeatures; + int maxFeatures; //! Set between 0.0 and 1.0, determines how quickly features are "forgotten" from histograms. - float learningRate; + float learningRate; //! Number of frames of video to use to initialize histograms. - int numInitializationFrames; + int numInitializationFrames; //! Number of discrete levels in each channel to be used in histograms. - int quantizationLevels; + int quantizationLevels; //! Prior probability that any given pixel is a background pixel. A sensitivity parameter. - float backgroundPrior; + float backgroundPrior; //! value above which pixel is determined to be FG. - float decisionThreshold; + float decisionThreshold; //! smoothing radius, in pixels, for cleaning up FG image. - int smoothingRadius; + int smoothingRadius; private: float maxVal_, minVal_; -- 2.7.4