001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.features2d;
005
006import java.util.ArrayList;
007import java.util.List;
008import org.opencv.core.Mat;
009import org.opencv.core.MatOfPoint;
010import org.opencv.core.MatOfRect;
011import org.opencv.features2d.Feature2D;
012import org.opencv.features2d.MSER;
013import org.opencv.utils.Converters;
014
015// C++: class MSER
016/**
017 * Maximally stable extremal region extractor
018 *
019 * The class encapsulates all the parameters of the %MSER extraction algorithm (see [wiki
020 * article](http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions)).
021 *
022 * <ul>
023 *   <li>
024 *  there are two different implementation of %MSER: one for grey image, one for color image
025 *   </li>
026 * </ul>
027 *
028 * <ul>
029 *   <li>
030 *  the grey image algorithm is taken from: CITE: nister2008linear ;  the paper claims to be faster
031 * than union-find method; it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop.
032 *   </li>
033 * </ul>
034 *
035 * <ul>
036 *   <li>
037 *  the color image algorithm is taken from: CITE: forssen2007maximally ; it should be much slower
038 * than grey image method ( 3~4 times )
039 *   </li>
040 * </ul>
041 *
042 * <ul>
043 *   <li>
044 *  (Python) A complete example showing the use of the %MSER detector can be found at samples/python/mser.py
045 *   </li>
046 * </ul>
047 */
048public class MSER extends Feature2D {
049
050    protected MSER(long addr) { super(addr); }
051
052    // internal usage only
053    public static MSER __fromPtr__(long addr) { return new MSER(addr); }
054
055    //
056    // C++: static Ptr_MSER cv::MSER::create(int delta = 5, int min_area = 60, int max_area = 14400, double max_variation = 0.25, double min_diversity = .2, int max_evolution = 200, double area_threshold = 1.01, double min_margin = 0.003, int edge_blur_size = 5)
057    //
058
059    /**
060     * Full constructor for %MSER detector
061     *
062     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
063     *     @param min_area prune the area which smaller than minArea
064     *     @param max_area prune the area which bigger than maxArea
065     *     @param max_variation prune the area have similar size to its children
066     *     @param min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
067     *     @param max_evolution  for color image, the evolution steps
068     *     @param area_threshold for color image, the area threshold to cause re-initialize
069     *     @param min_margin for color image, ignore too small margin
070     *     @param edge_blur_size for color image, the aperture size for edge blur
071     * @return automatically generated
072     */
073    public static MSER create(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution, double area_threshold, double min_margin, int edge_blur_size) {
074        return MSER.__fromPtr__(create_0(delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin, edge_blur_size));
075    }
076
077    /**
078     * Full constructor for %MSER detector
079     *
080     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
081     *     @param min_area prune the area which smaller than minArea
082     *     @param max_area prune the area which bigger than maxArea
083     *     @param max_variation prune the area have similar size to its children
084     *     @param min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
085     *     @param max_evolution  for color image, the evolution steps
086     *     @param area_threshold for color image, the area threshold to cause re-initialize
087     *     @param min_margin for color image, ignore too small margin
088     * @return automatically generated
089     */
090    public static MSER create(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution, double area_threshold, double min_margin) {
091        return MSER.__fromPtr__(create_1(delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin));
092    }
093
094    /**
095     * Full constructor for %MSER detector
096     *
097     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
098     *     @param min_area prune the area which smaller than minArea
099     *     @param max_area prune the area which bigger than maxArea
100     *     @param max_variation prune the area have similar size to its children
101     *     @param min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
102     *     @param max_evolution  for color image, the evolution steps
103     *     @param area_threshold for color image, the area threshold to cause re-initialize
104     * @return automatically generated
105     */
106    public static MSER create(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution, double area_threshold) {
107        return MSER.__fromPtr__(create_2(delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold));
108    }
109
110    /**
111     * Full constructor for %MSER detector
112     *
113     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
114     *     @param min_area prune the area which smaller than minArea
115     *     @param max_area prune the area which bigger than maxArea
116     *     @param max_variation prune the area have similar size to its children
117     *     @param min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
118     *     @param max_evolution  for color image, the evolution steps
119     * @return automatically generated
120     */
121    public static MSER create(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution) {
122        return MSER.__fromPtr__(create_3(delta, min_area, max_area, max_variation, min_diversity, max_evolution));
123    }
124
125    /**
126     * Full constructor for %MSER detector
127     *
128     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
129     *     @param min_area prune the area which smaller than minArea
130     *     @param max_area prune the area which bigger than maxArea
131     *     @param max_variation prune the area have similar size to its children
132     *     @param min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
133     * @return automatically generated
134     */
135    public static MSER create(int delta, int min_area, int max_area, double max_variation, double min_diversity) {
136        return MSER.__fromPtr__(create_4(delta, min_area, max_area, max_variation, min_diversity));
137    }
138
139    /**
140     * Full constructor for %MSER detector
141     *
142     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
143     *     @param min_area prune the area which smaller than minArea
144     *     @param max_area prune the area which bigger than maxArea
145     *     @param max_variation prune the area have similar size to its children
146     * @return automatically generated
147     */
148    public static MSER create(int delta, int min_area, int max_area, double max_variation) {
149        return MSER.__fromPtr__(create_5(delta, min_area, max_area, max_variation));
150    }
151
152    /**
153     * Full constructor for %MSER detector
154     *
155     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
156     *     @param min_area prune the area which smaller than minArea
157     *     @param max_area prune the area which bigger than maxArea
158     * @return automatically generated
159     */
160    public static MSER create(int delta, int min_area, int max_area) {
161        return MSER.__fromPtr__(create_6(delta, min_area, max_area));
162    }
163
164    /**
165     * Full constructor for %MSER detector
166     *
167     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
168     *     @param min_area prune the area which smaller than minArea
169     * @return automatically generated
170     */
171    public static MSER create(int delta, int min_area) {
172        return MSER.__fromPtr__(create_7(delta, min_area));
173    }
174
175    /**
176     * Full constructor for %MSER detector
177     *
178     *     @param delta it compares \((size_{i}-size_{i-delta})/size_{i-delta}\)
179     * @return automatically generated
180     */
181    public static MSER create(int delta) {
182        return MSER.__fromPtr__(create_8(delta));
183    }
184
185    /**
186     * Full constructor for %MSER detector
187     *
188     * @return automatically generated
189     */
190    public static MSER create() {
191        return MSER.__fromPtr__(create_9());
192    }
193
194
195    //
196    // C++:  void cv::MSER::detectRegions(Mat image, vector_vector_Point& msers, vector_Rect& bboxes)
197    //
198
199    /**
200     * Detect %MSER regions
201     *
202     *     @param image input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3)
203     *     @param msers resulting list of point sets
204     *     @param bboxes resulting bounding boxes
205     */
206    public void detectRegions(Mat image, List<MatOfPoint> msers, MatOfRect bboxes) {
207        Mat msers_mat = new Mat();
208        Mat bboxes_mat = bboxes;
209        detectRegions_0(nativeObj, image.nativeObj, msers_mat.nativeObj, bboxes_mat.nativeObj);
210        Converters.Mat_to_vector_vector_Point(msers_mat, msers);
211        msers_mat.release();
212    }
213
214
215    //
216    // C++:  void cv::MSER::setDelta(int delta)
217    //
218
219    public void setDelta(int delta) {
220        setDelta_0(nativeObj, delta);
221    }
222
223
224    //
225    // C++:  int cv::MSER::getDelta()
226    //
227
228    public int getDelta() {
229        return getDelta_0(nativeObj);
230    }
231
232
233    //
234    // C++:  void cv::MSER::setMinArea(int minArea)
235    //
236
237    public void setMinArea(int minArea) {
238        setMinArea_0(nativeObj, minArea);
239    }
240
241
242    //
243    // C++:  int cv::MSER::getMinArea()
244    //
245
246    public int getMinArea() {
247        return getMinArea_0(nativeObj);
248    }
249
250
251    //
252    // C++:  void cv::MSER::setMaxArea(int maxArea)
253    //
254
255    public void setMaxArea(int maxArea) {
256        setMaxArea_0(nativeObj, maxArea);
257    }
258
259
260    //
261    // C++:  int cv::MSER::getMaxArea()
262    //
263
264    public int getMaxArea() {
265        return getMaxArea_0(nativeObj);
266    }
267
268
269    //
270    // C++:  void cv::MSER::setPass2Only(bool f)
271    //
272
273    public void setPass2Only(boolean f) {
274        setPass2Only_0(nativeObj, f);
275    }
276
277
278    //
279    // C++:  bool cv::MSER::getPass2Only()
280    //
281
282    public boolean getPass2Only() {
283        return getPass2Only_0(nativeObj);
284    }
285
286
287    //
288    // C++:  String cv::MSER::getDefaultName()
289    //
290
291    public String getDefaultName() {
292        return getDefaultName_0(nativeObj);
293    }
294
295
296    @Override
297    protected void finalize() throws Throwable {
298        delete(nativeObj);
299    }
300
301
302
303    // C++: static Ptr_MSER cv::MSER::create(int delta = 5, int min_area = 60, int max_area = 14400, double max_variation = 0.25, double min_diversity = .2, int max_evolution = 200, double area_threshold = 1.01, double min_margin = 0.003, int edge_blur_size = 5)
304    private static native long create_0(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution, double area_threshold, double min_margin, int edge_blur_size);
305    private static native long create_1(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution, double area_threshold, double min_margin);
306    private static native long create_2(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution, double area_threshold);
307    private static native long create_3(int delta, int min_area, int max_area, double max_variation, double min_diversity, int max_evolution);
308    private static native long create_4(int delta, int min_area, int max_area, double max_variation, double min_diversity);
309    private static native long create_5(int delta, int min_area, int max_area, double max_variation);
310    private static native long create_6(int delta, int min_area, int max_area);
311    private static native long create_7(int delta, int min_area);
312    private static native long create_8(int delta);
313    private static native long create_9();
314
315    // C++:  void cv::MSER::detectRegions(Mat image, vector_vector_Point& msers, vector_Rect& bboxes)
316    private static native void detectRegions_0(long nativeObj, long image_nativeObj, long msers_mat_nativeObj, long bboxes_mat_nativeObj);
317
318    // C++:  void cv::MSER::setDelta(int delta)
319    private static native void setDelta_0(long nativeObj, int delta);
320
321    // C++:  int cv::MSER::getDelta()
322    private static native int getDelta_0(long nativeObj);
323
324    // C++:  void cv::MSER::setMinArea(int minArea)
325    private static native void setMinArea_0(long nativeObj, int minArea);
326
327    // C++:  int cv::MSER::getMinArea()
328    private static native int getMinArea_0(long nativeObj);
329
330    // C++:  void cv::MSER::setMaxArea(int maxArea)
331    private static native void setMaxArea_0(long nativeObj, int maxArea);
332
333    // C++:  int cv::MSER::getMaxArea()
334    private static native int getMaxArea_0(long nativeObj);
335
336    // C++:  void cv::MSER::setPass2Only(bool f)
337    private static native void setPass2Only_0(long nativeObj, boolean f);
338
339    // C++:  bool cv::MSER::getPass2Only()
340    private static native boolean getPass2Only_0(long nativeObj);
341
342    // C++:  String cv::MSER::getDefaultName()
343    private static native String getDefaultName_0(long nativeObj);
344
345    // native support for java finalize()
346    private static native void delete(long nativeObj);
347
348}