### Navigation

- index
- next |
- previous |
- OpenCV 2.4.5.0 documentation »
- OpenCV API Reference »
- nonfree. Non-free functionality »

# Background Subtraction

## gpu::VIBE_GPU

class `gpu::``VIBE_GPU`

Class used for background/foreground segmentation.

    class VIBE_GPU
    {
    public:
        explicit VIBE_GPU(unsigned long rngSeed = 1234567);

        void initialize(const GpuMat& firstFrame, Stream& stream = Stream::Null());

        void operator()(const GpuMat& frame, GpuMat& fgmask, Stream& stream = Stream::Null());

        void release();

        ...
    };

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.

C++:`` `gpu::VIBE_GPU::``VIBE_GPU`(unsigned long rngSeed=1234567)

  Parameters: | 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.

C++:`` void `gpu::VIBE_GPU::``initialize`(const GpuMat& firstFrame, Stream& stream=Stream::Null())

  Parameters: | firstFrame – First frame from video sequence. stream – Stream for the asynchronous version.

## gpu::VIBE_GPU::operator()

Updates the background model and returns the foreground mask

C++:`` void `gpu::VIBE_GPU::``operator()`(const GpuMat& frame, GpuMat& fgmask, Stream& stream=Stream::Null())

  Parameters: | frame – Next video frame. fgmask – The output foreground mask as an 8-bit binary image. stream – Stream for the asynchronous version.

## gpu::VIBE_GPU::release

Releases all inner buffer’s memory.

C++:`` void `gpu::VIBE_GPU::``release`()

[VIBE2011] | 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

## Help and Feedback

You did not find what you were looking for?

- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation, please file a bug report.

### Navigation

- index
- next |
- previous |
- OpenCV 2.4.5.0 documentation »
- OpenCV API Reference »
- nonfree. Non-free functionality »