001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.video;
005
006import org.opencv.core.Algorithm;
007import org.opencv.core.Mat;
008
009// C++: class BackgroundSubtractor
010/**
011 * Base class for background/foreground segmentation. :
012 *
013 * The class is only used to define the common interface for the whole family of background/foreground
014 * segmentation algorithms.
015 */
016public class BackgroundSubtractor extends Algorithm {
017
018    protected BackgroundSubtractor(long addr) { super(addr); }
019
020    // internal usage only
021    public static BackgroundSubtractor __fromPtr__(long addr) { return new BackgroundSubtractor(addr); }
022
023    //
024    // C++:  void cv::BackgroundSubtractor::apply(Mat image, Mat& fgmask, double learningRate = -1)
025    //
026
027    /**
028     * Computes a foreground mask.
029     *
030     *     @param image Next video frame.
031     *     @param fgmask The output foreground mask as an 8-bit binary image.
032     *     @param learningRate The value between 0 and 1 that indicates how fast the background model is
033     *     learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
034     *     rate. 0 means that the background model is not updated at all, 1 means that the background model
035     *     is completely reinitialized from the last frame.
036     */
037    public void apply(Mat image, Mat fgmask, double learningRate) {
038        apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate);
039    }
040
041    /**
042     * Computes a foreground mask.
043     *
044     *     @param image Next video frame.
045     *     @param fgmask The output foreground mask as an 8-bit binary image.
046     *     learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
047     *     rate. 0 means that the background model is not updated at all, 1 means that the background model
048     *     is completely reinitialized from the last frame.
049     */
050    public void apply(Mat image, Mat fgmask) {
051        apply_1(nativeObj, image.nativeObj, fgmask.nativeObj);
052    }
053
054
055    //
056    // C++:  void cv::BackgroundSubtractor::getBackgroundImage(Mat& backgroundImage)
057    //
058
059    /**
060     * Computes a background image.
061     *
062     *     @param backgroundImage The output background image.
063     *
064     *     <b>Note:</b> Sometimes the background image can be very blurry, as it contain the average background
065     *     statistics.
066     */
067    public void getBackgroundImage(Mat backgroundImage) {
068        getBackgroundImage_0(nativeObj, backgroundImage.nativeObj);
069    }
070
071
072    @Override
073    protected void finalize() throws Throwable {
074        delete(nativeObj);
075    }
076
077
078
079    // C++:  void cv::BackgroundSubtractor::apply(Mat image, Mat& fgmask, double learningRate = -1)
080    private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, double learningRate);
081    private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj);
082
083    // C++:  void cv::BackgroundSubtractor::getBackgroundImage(Mat& backgroundImage)
084    private static native void getBackgroundImage_0(long nativeObj, long backgroundImage_nativeObj);
085
086    // native support for java finalize()
087    private static native void delete(long nativeObj);
088
089}