001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.video;
005
006import org.opencv.video.BackgroundSubtractor;
007
008// C++: class BackgroundSubtractorKNN
009/**
010 * K-nearest neighbours - based Background/Foreground Segmentation Algorithm.
011 *
012 * The class implements the K-nearest neighbours background subtraction described in CITE: Zivkovic2006 .
013 * Very efficient if number of foreground pixels is low.
014 */
015public class BackgroundSubtractorKNN extends BackgroundSubtractor {
016
017    protected BackgroundSubtractorKNN(long addr) { super(addr); }
018
019    // internal usage only
020    public static BackgroundSubtractorKNN __fromPtr__(long addr) { return new BackgroundSubtractorKNN(addr); }
021
022    //
023    // C++:  int cv::BackgroundSubtractorKNN::getHistory()
024    //
025
026    /**
027     * Returns the number of last frames that affect the background model
028     * @return automatically generated
029     */
030    public int getHistory() {
031        return getHistory_0(nativeObj);
032    }
033
034
035    //
036    // C++:  void cv::BackgroundSubtractorKNN::setHistory(int history)
037    //
038
039    /**
040     * Sets the number of last frames that affect the background model
041     * @param history automatically generated
042     */
043    public void setHistory(int history) {
044        setHistory_0(nativeObj, history);
045    }
046
047
048    //
049    // C++:  int cv::BackgroundSubtractorKNN::getNSamples()
050    //
051
052    /**
053     * Returns the number of data samples in the background model
054     * @return automatically generated
055     */
056    public int getNSamples() {
057        return getNSamples_0(nativeObj);
058    }
059
060
061    //
062    // C++:  void cv::BackgroundSubtractorKNN::setNSamples(int _nN)
063    //
064
065    /**
066     * Sets the number of data samples in the background model.
067     *
068     *     The model needs to be reinitalized to reserve memory.
069     * @param _nN automatically generated
070     */
071    public void setNSamples(int _nN) {
072        setNSamples_0(nativeObj, _nN);
073    }
074
075
076    //
077    // C++:  double cv::BackgroundSubtractorKNN::getDist2Threshold()
078    //
079
080    /**
081     * Returns the threshold on the squared distance between the pixel and the sample
082     *
083     *     The threshold on the squared distance between the pixel and the sample to decide whether a pixel is
084     *     close to a data sample.
085     * @return automatically generated
086     */
087    public double getDist2Threshold() {
088        return getDist2Threshold_0(nativeObj);
089    }
090
091
092    //
093    // C++:  void cv::BackgroundSubtractorKNN::setDist2Threshold(double _dist2Threshold)
094    //
095
096    /**
097     * Sets the threshold on the squared distance
098     * @param _dist2Threshold automatically generated
099     */
100    public void setDist2Threshold(double _dist2Threshold) {
101        setDist2Threshold_0(nativeObj, _dist2Threshold);
102    }
103
104
105    //
106    // C++:  int cv::BackgroundSubtractorKNN::getkNNSamples()
107    //
108
109    /**
110     * Returns the number of neighbours, the k in the kNN.
111     *
112     *     K is the number of samples that need to be within dist2Threshold in order to decide that that
113     *     pixel is matching the kNN background model.
114     * @return automatically generated
115     */
116    public int getkNNSamples() {
117        return getkNNSamples_0(nativeObj);
118    }
119
120
121    //
122    // C++:  void cv::BackgroundSubtractorKNN::setkNNSamples(int _nkNN)
123    //
124
125    /**
126     * Sets the k in the kNN. How many nearest neighbours need to match.
127     * @param _nkNN automatically generated
128     */
129    public void setkNNSamples(int _nkNN) {
130        setkNNSamples_0(nativeObj, _nkNN);
131    }
132
133
134    //
135    // C++:  bool cv::BackgroundSubtractorKNN::getDetectShadows()
136    //
137
138    /**
139     * Returns the shadow detection flag
140     *
141     *     If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for
142     *     details.
143     * @return automatically generated
144     */
145    public boolean getDetectShadows() {
146        return getDetectShadows_0(nativeObj);
147    }
148
149
150    //
151    // C++:  void cv::BackgroundSubtractorKNN::setDetectShadows(bool detectShadows)
152    //
153
154    /**
155     * Enables or disables shadow detection
156     * @param detectShadows automatically generated
157     */
158    public void setDetectShadows(boolean detectShadows) {
159        setDetectShadows_0(nativeObj, detectShadows);
160    }
161
162
163    //
164    // C++:  int cv::BackgroundSubtractorKNN::getShadowValue()
165    //
166
167    /**
168     * Returns the shadow value
169     *
170     *     Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
171     *     in the mask always means background, 255 means foreground.
172     * @return automatically generated
173     */
174    public int getShadowValue() {
175        return getShadowValue_0(nativeObj);
176    }
177
178
179    //
180    // C++:  void cv::BackgroundSubtractorKNN::setShadowValue(int value)
181    //
182
183    /**
184     * Sets the shadow value
185     * @param value automatically generated
186     */
187    public void setShadowValue(int value) {
188        setShadowValue_0(nativeObj, value);
189    }
190
191
192    //
193    // C++:  double cv::BackgroundSubtractorKNN::getShadowThreshold()
194    //
195
196    /**
197     * Returns the shadow threshold
198     *
199     *     A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
200     *     the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
201     *     is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
202     * Detecting Moving Shadows...*, IEEE PAMI,2003.
203     * @return automatically generated
204     */
205    public double getShadowThreshold() {
206        return getShadowThreshold_0(nativeObj);
207    }
208
209
210    //
211    // C++:  void cv::BackgroundSubtractorKNN::setShadowThreshold(double threshold)
212    //
213
214    /**
215     * Sets the shadow threshold
216     * @param threshold automatically generated
217     */
218    public void setShadowThreshold(double threshold) {
219        setShadowThreshold_0(nativeObj, threshold);
220    }
221
222
223    @Override
224    protected void finalize() throws Throwable {
225        delete(nativeObj);
226    }
227
228
229
230    // C++:  int cv::BackgroundSubtractorKNN::getHistory()
231    private static native int getHistory_0(long nativeObj);
232
233    // C++:  void cv::BackgroundSubtractorKNN::setHistory(int history)
234    private static native void setHistory_0(long nativeObj, int history);
235
236    // C++:  int cv::BackgroundSubtractorKNN::getNSamples()
237    private static native int getNSamples_0(long nativeObj);
238
239    // C++:  void cv::BackgroundSubtractorKNN::setNSamples(int _nN)
240    private static native void setNSamples_0(long nativeObj, int _nN);
241
242    // C++:  double cv::BackgroundSubtractorKNN::getDist2Threshold()
243    private static native double getDist2Threshold_0(long nativeObj);
244
245    // C++:  void cv::BackgroundSubtractorKNN::setDist2Threshold(double _dist2Threshold)
246    private static native void setDist2Threshold_0(long nativeObj, double _dist2Threshold);
247
248    // C++:  int cv::BackgroundSubtractorKNN::getkNNSamples()
249    private static native int getkNNSamples_0(long nativeObj);
250
251    // C++:  void cv::BackgroundSubtractorKNN::setkNNSamples(int _nkNN)
252    private static native void setkNNSamples_0(long nativeObj, int _nkNN);
253
254    // C++:  bool cv::BackgroundSubtractorKNN::getDetectShadows()
255    private static native boolean getDetectShadows_0(long nativeObj);
256
257    // C++:  void cv::BackgroundSubtractorKNN::setDetectShadows(bool detectShadows)
258    private static native void setDetectShadows_0(long nativeObj, boolean detectShadows);
259
260    // C++:  int cv::BackgroundSubtractorKNN::getShadowValue()
261    private static native int getShadowValue_0(long nativeObj);
262
263    // C++:  void cv::BackgroundSubtractorKNN::setShadowValue(int value)
264    private static native void setShadowValue_0(long nativeObj, int value);
265
266    // C++:  double cv::BackgroundSubtractorKNN::getShadowThreshold()
267    private static native double getShadowThreshold_0(long nativeObj);
268
269    // C++:  void cv::BackgroundSubtractorKNN::setShadowThreshold(double threshold)
270    private static native void setShadowThreshold_0(long nativeObj, double threshold);
271
272    // native support for java finalize()
273    private static native void delete(long nativeObj);
274
275}