:param maxCorners:Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned.
:param qualityLevel:Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see :ocv:func:`gpu::cornerMinEigenVal` ) or the Harris function response (see :ocv:func:`gpu::cornerHarris` ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the ``qualityLevel=0.01`` , then all the corners with the quality measure less than 15 are rejected.
:param minDistance:Minimum possible Euclidean distance between the returned corners.
:param blockSize:Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See :ocv:func:`cornerEigenValsAndVecs` .
:param useHarrisDetector:Parameter indicating whether to use a Harris detector (see :ocv:func:`gpu::cornerHarris`) or :ocv:func:`gpu::cornerMinEigenVal`.
:param harrisK:Free parameter of the Harris detector.
:param corners:Output vector of detected corners (it will be one row matrix with CV_32FC2 type).
:param mask:Optional region of interest. If the image is not empty (it needs to have the type ``CV_8UC1`` and the same size as ``image`` ), it specifies the region in which the corners are detected.
:param prevImg:First 8-bit input image (supports both grayscale and color images).
:param nextImg:Second input image of the same size and the same type as ``prevImg`` .
:param prevPts:Vector of 2D points for which the flow needs to be found. It must be one row matrix with CV_32FC2 type.
:param nextPts:Output vector of 2D points (with single-precision floating-point coordinates) containing the calculated new positions of input features in the second image. When ``useInitialFlow`` is true, the vector must have the same size as in the input.
:param status:Output status vector (CV_8UC1 type). Each element of the vector is set to 1 if the flow for the corresponding features has been found. Otherwise, it is set to 0.
:param err:Output vector (CV_32FC1 type) that contains the difference between patches around the original and moved points or min eigen value if ``getMinEigenVals`` is checked. It can be NULL, if not needed.
:param nextImg:Second input image of the same size and the same type as ``prevImg`` .
:param u:Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
:param v:Vertical component of the optical flow of the same size as input images, 32-bit floating-point, single-channel
:param err:Output vector (CV_32FC1 type) that contains the difference between patches around the original and moved points or min eigen value if ``getMinEigenVals`` is checked. It can be NULL, if not needed.
:param frame0:First frame (32-bit floating point images, single channel).
:param frame1:Second frame. Must have the same type and size as ``frame0`` .
:param fu:Forward horizontal displacement.
:param fv:Forward vertical displacement.
:param bu:Backward horizontal displacement.
:param bv:Backward vertical displacement.
:param pos:New frame position.
:param newFrame:Output image.
:param buf:Temporary buffer, will have width x 6*height size, CV_32FC1 type and contain 6 GpuMat: occlusion masks for first frame, occlusion masks for second, interpolated forward horizontal flow, interpolated forward vertical flow, interpolated backward horizontal flow, interpolated backward vertical flow.
:param stream:Stream for the asynchronous version.
gpu::FGDStatModel
-----------------
..ocv:class:: gpu::FGDStatModel
Class used for background/foreground segmentation. ::
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 [FGD2003]_.
The results are available through the class fields:
..ocv:member:: cv::gpu::GpuMat background
The output background image.
..ocv:member:: cv::gpu::GpuMat foreground
The output foreground mask as an 8-bit binary image.
..ocv:member:: cv::gpu::GpuMat foreground_regions
The output foreground regions calculated by :ocv:func:`findContours`.
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 [MOG2001]_.
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 [MOG2004]_.
Here are important members of the class that control the algorithm, which you can set after constructing the class instance:
..ocv:member:: float backgroundRatio
Threshold defining whether the component is significant enough to be included into the background model ( corresponds to ``TB=1-cf`` from the paper??which paper??). ``cf=0.1 => TB=0.9`` is default. For ``alpha=0.001``, it means that the mode should exist for approximately 105 frames before it is considered foreground.
..ocv:member:: float varThreshold
Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to ``Tg``). If it is not close to any component, a new component is generated. ``3 sigma => Tg=3*3=9`` is default. A smaller ``Tg`` value generates more components. A higher ``Tg`` value may result in a small number of components but they can grow too large.
..ocv:member:: float fVarInit
Initial variance for the newly generated components. It affects the speed of adaptation. The parameter value is based on your estimate of the typical standard deviation from the images. OpenCV uses 15 as a reasonable value.
..ocv:member:: float fVarMin
Parameter used to further control the variance.
..ocv:member:: float fVarMax
Parameter used to further control the variance.
..ocv:member:: float fCT
Complexity reduction parameter. This parameter defines the number of samples needed to accept to prove the component exists. ``CT=0.05`` is a default value for all the samples. By setting ``CT=0`` you get an algorithm very similar to the standard Stauffer&Grimson algorithm.
..ocv:member:: uchar nShadowDetection
The value for marking shadow pixels in the output foreground mask. Default value is 127.
..ocv:member:: float fTau
Shadow threshold. The shadow is detected if the pixel is a darker version of the background. ``Tau`` is a threshold defining how much darker the shadow can be. ``Tau= 0.5`` means that if a pixel is more than twice darker then it is not shadow. See [ShadowDetect2003]_.
..ocv:member:: bool bShadowDetection
Parameter defining whether shadow detection should be enabled.
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 [VIBE2011]_.
gpu::VIBE_GPU::VIBE_GPU
-----------------------
The constructor.
..ocv:function:: gpu::VIBE_GPU::VIBE_GPU(unsigned long rngSeed = 1234567)
:param rngSeed:Value used to initiate a random sequence.
Default constructor sets all parameters to default values.
gpu::VIBE_GPU::initialize
-------------------------
Initialize background model and allocates all inner buffers.
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
:param fileName:Name of the output video file. Only AVI file format is supported.
:param frameSize:Size of the input video frames.
:param fps:Framerate of the created video stream.
:param params:Encoder parameters. See :ocv:class:`gpu::VideoWriter_GPU::EncoderParams` .
:param format:Surface format of input frames ( ``SF_UYVY`` , ``SF_YUY2`` , ``SF_YV12`` , ``SF_NV12`` , ``SF_IYUV`` , ``SF_BGR`` or ``SF_GRAY``). BGR or gray frames will be converted to YV12 format before encoding, frames with other formats will be used as is.
:param encoderCallback:Callbacks for video encoder. See :ocv:class:`gpu::VideoWriter_GPU::EncoderCallBack` . Use it if you want to work with raw video stream.
The constructors initialize video writer. FFMPEG is used to write videos. User can implement own multiplexing with :ocv:class:`gpu::VideoWriter_GPU::EncoderCallBack` .
The method opens video writer. Parameters are the same as in the constructor :ocv:func:`gpu::VideoWriter_GPU::VideoWriter_GPU` . The method throws :ocv:class:`Exception` if error occurs.
gpu::VideoWriter_GPU::isOpened
------------------------------
Returns true if video writer has been successfully initialized.
:param lastFrame:Indicates that it is end of stream. The parameter can be ignored.
The method write the specified image to video file. The image must have the same size and the same surface format as has been specified when opening the video writer.
:param source:Video file parser implemented by user.
The constructors initialize video reader. FFMPEG is used to read videos. User can implement own demultiplexing with :ocv:class:`gpu::VideoReader_GPU::VideoSource` .
The method opens video reader. Parameters are the same as in the constructor :ocv:func:`gpu::VideoReader_GPU::VideoReader_GPU` . The method throws :ocv:class:`Exception` if error occurs.
gpu::VideoReader_GPU::isOpened
------------------------------
Returns true if video reader has been successfully initialized.
If no frames has been grabbed (there are no more frames in video file), the methods return ``false`` . The method throws :ocv:class:`Exception` if error occurs.
..[MOG2001] P. KadewTraKuPong and R. Bowden. *An improved adaptive background mixture model for real-time tracking with shadow detection*. Proc. 2nd European Workshop on Advanced Video-Based Surveillance Systems, 2001
..[MOG2004] Z. Zivkovic. *Improved adaptive Gausian mixture model for background subtraction*. International Conference Pattern Recognition, UK, August, 2004
..[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