001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.objdetect;
005
006import java.util.ArrayList;
007import java.util.List;
008import org.opencv.core.Mat;
009import org.opencv.core.MatOfInt;
010import org.opencv.core.MatOfRect;
011import org.opencv.core.Scalar;
012import org.opencv.objdetect.Dictionary;
013import org.opencv.utils.Converters;
014
015// C++: class Objdetect
016
017public class Objdetect {
018
019    // C++: enum <unnamed>
020    public static final int
021            CASCADE_DO_CANNY_PRUNING = 1,
022            CASCADE_SCALE_IMAGE = 2,
023            CASCADE_FIND_BIGGEST_OBJECT = 4,
024            CASCADE_DO_ROUGH_SEARCH = 8;
025
026
027    // C++: enum ObjectStatus (cv.DetectionBasedTracker.ObjectStatus)
028    public static final int
029            DetectionBasedTracker_DETECTED_NOT_SHOWN_YET = 0,
030            DetectionBasedTracker_DETECTED = 1,
031            DetectionBasedTracker_DETECTED_TEMPORARY_LOST = 2,
032            DetectionBasedTracker_WRONG_OBJECT = 3;
033
034
035    // C++: enum CornerRefineMethod (cv.aruco.CornerRefineMethod)
036    public static final int
037            CORNER_REFINE_NONE = 0,
038            CORNER_REFINE_SUBPIX = 1,
039            CORNER_REFINE_CONTOUR = 2,
040            CORNER_REFINE_APRILTAG = 3;
041
042
043    // C++: enum PredefinedDictionaryType (cv.aruco.PredefinedDictionaryType)
044    public static final int
045            DICT_4X4_50 = 0,
046            DICT_4X4_100 = 0+1,
047            DICT_4X4_250 = 0+2,
048            DICT_4X4_1000 = 0+3,
049            DICT_5X5_50 = 0+4,
050            DICT_5X5_100 = 0+5,
051            DICT_5X5_250 = 0+6,
052            DICT_5X5_1000 = 0+7,
053            DICT_6X6_50 = 0+8,
054            DICT_6X6_100 = 0+9,
055            DICT_6X6_250 = 0+10,
056            DICT_6X6_1000 = 0+11,
057            DICT_7X7_50 = 0+12,
058            DICT_7X7_100 = 0+13,
059            DICT_7X7_250 = 0+14,
060            DICT_7X7_1000 = 0+15,
061            DICT_ARUCO_ORIGINAL = 0+16,
062            DICT_APRILTAG_16h5 = 0+17,
063            DICT_APRILTAG_25h9 = 0+18,
064            DICT_APRILTAG_36h10 = 0+19,
065            DICT_APRILTAG_36h11 = 0+20,
066            DICT_ARUCO_MIP_36h12 = 0+21;
067
068
069    //
070    // C++:  void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2)
071    //
072
073    public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) {
074        Mat rectList_mat = rectList;
075        Mat weights_mat = weights;
076        groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps);
077    }
078
079    public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) {
080        Mat rectList_mat = rectList;
081        Mat weights_mat = weights;
082        groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
083    }
084
085
086    //
087    // C++:  void cv::aruco::drawDetectedMarkers(Mat& image, vector_Mat corners, Mat ids = Mat(), Scalar borderColor = Scalar(0, 255, 0))
088    //
089
090    /**
091     * Draw detected markers in image
092     *
093     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not altered.
094     * @param corners positions of marker corners on input image.
095     * (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers, the dimensions of
096     * this array should be Nx4. The order of the corners should be clockwise.
097     * @param ids vector of identifiers for markers in markersCorners .
098     * Optional, if not provided, ids are not painted.
099     * @param borderColor color of marker borders. Rest of colors (text color and first corner color)
100     * are calculated based on this one to improve visualization.
101     *
102     * Given an array of detected marker corners and its corresponding ids, this functions draws
103     * the markers in the image. The marker borders are painted and the markers identifiers if provided.
104     * Useful for debugging purposes.
105     */
106    public static void drawDetectedMarkers(Mat image, List<Mat> corners, Mat ids, Scalar borderColor) {
107        Mat corners_mat = Converters.vector_Mat_to_Mat(corners);
108        drawDetectedMarkers_0(image.nativeObj, corners_mat.nativeObj, ids.nativeObj, borderColor.val[0], borderColor.val[1], borderColor.val[2], borderColor.val[3]);
109    }
110
111    /**
112     * Draw detected markers in image
113     *
114     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not altered.
115     * @param corners positions of marker corners on input image.
116     * (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers, the dimensions of
117     * this array should be Nx4. The order of the corners should be clockwise.
118     * @param ids vector of identifiers for markers in markersCorners .
119     * Optional, if not provided, ids are not painted.
120     * are calculated based on this one to improve visualization.
121     *
122     * Given an array of detected marker corners and its corresponding ids, this functions draws
123     * the markers in the image. The marker borders are painted and the markers identifiers if provided.
124     * Useful for debugging purposes.
125     */
126    public static void drawDetectedMarkers(Mat image, List<Mat> corners, Mat ids) {
127        Mat corners_mat = Converters.vector_Mat_to_Mat(corners);
128        drawDetectedMarkers_1(image.nativeObj, corners_mat.nativeObj, ids.nativeObj);
129    }
130
131    /**
132     * Draw detected markers in image
133     *
134     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not altered.
135     * @param corners positions of marker corners on input image.
136     * (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers, the dimensions of
137     * this array should be Nx4. The order of the corners should be clockwise.
138     * Optional, if not provided, ids are not painted.
139     * are calculated based on this one to improve visualization.
140     *
141     * Given an array of detected marker corners and its corresponding ids, this functions draws
142     * the markers in the image. The marker borders are painted and the markers identifiers if provided.
143     * Useful for debugging purposes.
144     */
145    public static void drawDetectedMarkers(Mat image, List<Mat> corners) {
146        Mat corners_mat = Converters.vector_Mat_to_Mat(corners);
147        drawDetectedMarkers_2(image.nativeObj, corners_mat.nativeObj);
148    }
149
150
151    //
152    // C++:  void cv::aruco::generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat& img, int borderBits = 1)
153    //
154
155    /**
156     * Generate a canonical marker image
157     *
158     * @param dictionary dictionary of markers indicating the type of markers
159     * @param id identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.
160     * @param sidePixels size of the image in pixels
161     * @param img output image with the marker
162     * @param borderBits width of the marker border.
163     *
164     * This function returns a marker image in its canonical form (i.e. ready to be printed)
165     */
166    public static void generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img, int borderBits) {
167        generateImageMarker_0(dictionary.nativeObj, id, sidePixels, img.nativeObj, borderBits);
168    }
169
170    /**
171     * Generate a canonical marker image
172     *
173     * @param dictionary dictionary of markers indicating the type of markers
174     * @param id identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.
175     * @param sidePixels size of the image in pixels
176     * @param img output image with the marker
177     *
178     * This function returns a marker image in its canonical form (i.e. ready to be printed)
179     */
180    public static void generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img) {
181        generateImageMarker_1(dictionary.nativeObj, id, sidePixels, img.nativeObj);
182    }
183
184
185    //
186    // C++:  void cv::aruco::drawDetectedCornersCharuco(Mat& image, Mat charucoCorners, Mat charucoIds = Mat(), Scalar cornerColor = Scalar(255, 0, 0))
187    //
188
189    /**
190     * Draws a set of Charuco corners
191     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not
192     * altered.
193     * @param charucoCorners vector of detected charuco corners
194     * @param charucoIds list of identifiers for each corner in charucoCorners
195     * @param cornerColor color of the square surrounding each corner
196     *
197     * This function draws a set of detected Charuco corners. If identifiers vector is provided, it also
198     * draws the id of each corner.
199     */
200    public static void drawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds, Scalar cornerColor) {
201        drawDetectedCornersCharuco_0(image.nativeObj, charucoCorners.nativeObj, charucoIds.nativeObj, cornerColor.val[0], cornerColor.val[1], cornerColor.val[2], cornerColor.val[3]);
202    }
203
204    /**
205     * Draws a set of Charuco corners
206     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not
207     * altered.
208     * @param charucoCorners vector of detected charuco corners
209     * @param charucoIds list of identifiers for each corner in charucoCorners
210     *
211     * This function draws a set of detected Charuco corners. If identifiers vector is provided, it also
212     * draws the id of each corner.
213     */
214    public static void drawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds) {
215        drawDetectedCornersCharuco_1(image.nativeObj, charucoCorners.nativeObj, charucoIds.nativeObj);
216    }
217
218    /**
219     * Draws a set of Charuco corners
220     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not
221     * altered.
222     * @param charucoCorners vector of detected charuco corners
223     *
224     * This function draws a set of detected Charuco corners. If identifiers vector is provided, it also
225     * draws the id of each corner.
226     */
227    public static void drawDetectedCornersCharuco(Mat image, Mat charucoCorners) {
228        drawDetectedCornersCharuco_2(image.nativeObj, charucoCorners.nativeObj);
229    }
230
231
232    //
233    // C++:  void cv::aruco::drawDetectedDiamonds(Mat& image, vector_Mat diamondCorners, Mat diamondIds = Mat(), Scalar borderColor = Scalar(0, 0, 255))
234    //
235
236    /**
237     * Draw a set of detected ChArUco Diamond markers
238     *
239     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not
240     * altered.
241     * @param diamondCorners positions of diamond corners in the same format returned by
242     * detectCharucoDiamond(). (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers,
243     * the dimensions of this array should be Nx4. The order of the corners should be clockwise.
244     * @param diamondIds vector of identifiers for diamonds in diamondCorners, in the same format
245     * returned by detectCharucoDiamond() (e.g. std::vector&lt;Vec4i&gt;).
246     * Optional, if not provided, ids are not painted.
247     * @param borderColor color of marker borders. Rest of colors (text color and first corner color)
248     * are calculated based on this one.
249     *
250     * Given an array of detected diamonds, this functions draws them in the image. The marker borders
251     * are painted and the markers identifiers if provided.
252     * Useful for debugging purposes.
253     */
254    public static void drawDetectedDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds, Scalar borderColor) {
255        Mat diamondCorners_mat = Converters.vector_Mat_to_Mat(diamondCorners);
256        drawDetectedDiamonds_0(image.nativeObj, diamondCorners_mat.nativeObj, diamondIds.nativeObj, borderColor.val[0], borderColor.val[1], borderColor.val[2], borderColor.val[3]);
257    }
258
259    /**
260     * Draw a set of detected ChArUco Diamond markers
261     *
262     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not
263     * altered.
264     * @param diamondCorners positions of diamond corners in the same format returned by
265     * detectCharucoDiamond(). (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers,
266     * the dimensions of this array should be Nx4. The order of the corners should be clockwise.
267     * @param diamondIds vector of identifiers for diamonds in diamondCorners, in the same format
268     * returned by detectCharucoDiamond() (e.g. std::vector&lt;Vec4i&gt;).
269     * Optional, if not provided, ids are not painted.
270     * are calculated based on this one.
271     *
272     * Given an array of detected diamonds, this functions draws them in the image. The marker borders
273     * are painted and the markers identifiers if provided.
274     * Useful for debugging purposes.
275     */
276    public static void drawDetectedDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds) {
277        Mat diamondCorners_mat = Converters.vector_Mat_to_Mat(diamondCorners);
278        drawDetectedDiamonds_1(image.nativeObj, diamondCorners_mat.nativeObj, diamondIds.nativeObj);
279    }
280
281    /**
282     * Draw a set of detected ChArUco Diamond markers
283     *
284     * @param image input/output image. It must have 1 or 3 channels. The number of channels is not
285     * altered.
286     * @param diamondCorners positions of diamond corners in the same format returned by
287     * detectCharucoDiamond(). (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers,
288     * the dimensions of this array should be Nx4. The order of the corners should be clockwise.
289     * returned by detectCharucoDiamond() (e.g. std::vector&lt;Vec4i&gt;).
290     * Optional, if not provided, ids are not painted.
291     * are calculated based on this one.
292     *
293     * Given an array of detected diamonds, this functions draws them in the image. The marker borders
294     * are painted and the markers identifiers if provided.
295     * Useful for debugging purposes.
296     */
297    public static void drawDetectedDiamonds(Mat image, List<Mat> diamondCorners) {
298        Mat diamondCorners_mat = Converters.vector_Mat_to_Mat(diamondCorners);
299        drawDetectedDiamonds_2(image.nativeObj, diamondCorners_mat.nativeObj);
300    }
301
302
303    //
304    // C++:  Dictionary cv::aruco::getPredefinedDictionary(int dict)
305    //
306
307    /**
308     * Returns one of the predefined dictionaries referenced by DICT_*.
309     * @param dict automatically generated
310     * @return automatically generated
311     */
312    public static Dictionary getPredefinedDictionary(int dict) {
313        return new Dictionary(getPredefinedDictionary_0(dict));
314    }
315
316
317    //
318    // C++:  Dictionary cv::aruco::extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary = Dictionary(), int randomSeed = 0)
319    //
320
321    /**
322     * Extend base dictionary by new nMarkers
323     *
324     * @param nMarkers number of markers in the dictionary
325     * @param markerSize number of bits per dimension of each markers
326     * @param baseDictionary Include the markers in this dictionary at the beginning (optional)
327     * @param randomSeed a user supplied seed for theRNG()
328     *
329     * This function creates a new dictionary composed by nMarkers markers and each markers composed
330     * by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly
331     * included and the rest are generated based on them. If the size of baseDictionary is higher
332     * than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
333     * @return automatically generated
334     */
335    public static Dictionary extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary, int randomSeed) {
336        return new Dictionary(extendDictionary_0(nMarkers, markerSize, baseDictionary.nativeObj, randomSeed));
337    }
338
339    /**
340     * Extend base dictionary by new nMarkers
341     *
342     * @param nMarkers number of markers in the dictionary
343     * @param markerSize number of bits per dimension of each markers
344     * @param baseDictionary Include the markers in this dictionary at the beginning (optional)
345     *
346     * This function creates a new dictionary composed by nMarkers markers and each markers composed
347     * by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly
348     * included and the rest are generated based on them. If the size of baseDictionary is higher
349     * than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
350     * @return automatically generated
351     */
352    public static Dictionary extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary) {
353        return new Dictionary(extendDictionary_1(nMarkers, markerSize, baseDictionary.nativeObj));
354    }
355
356    /**
357     * Extend base dictionary by new nMarkers
358     *
359     * @param nMarkers number of markers in the dictionary
360     * @param markerSize number of bits per dimension of each markers
361     *
362     * This function creates a new dictionary composed by nMarkers markers and each markers composed
363     * by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly
364     * included and the rest are generated based on them. If the size of baseDictionary is higher
365     * than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
366     * @return automatically generated
367     */
368    public static Dictionary extendDictionary(int nMarkers, int markerSize) {
369        return new Dictionary(extendDictionary_2(nMarkers, markerSize));
370    }
371
372
373
374
375    // C++:  void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2)
376    private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps);
377    private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold);
378
379    // C++:  void cv::aruco::drawDetectedMarkers(Mat& image, vector_Mat corners, Mat ids = Mat(), Scalar borderColor = Scalar(0, 255, 0))
380    private static native void drawDetectedMarkers_0(long image_nativeObj, long corners_mat_nativeObj, long ids_nativeObj, double borderColor_val0, double borderColor_val1, double borderColor_val2, double borderColor_val3);
381    private static native void drawDetectedMarkers_1(long image_nativeObj, long corners_mat_nativeObj, long ids_nativeObj);
382    private static native void drawDetectedMarkers_2(long image_nativeObj, long corners_mat_nativeObj);
383
384    // C++:  void cv::aruco::generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat& img, int borderBits = 1)
385    private static native void generateImageMarker_0(long dictionary_nativeObj, int id, int sidePixels, long img_nativeObj, int borderBits);
386    private static native void generateImageMarker_1(long dictionary_nativeObj, int id, int sidePixels, long img_nativeObj);
387
388    // C++:  void cv::aruco::drawDetectedCornersCharuco(Mat& image, Mat charucoCorners, Mat charucoIds = Mat(), Scalar cornerColor = Scalar(255, 0, 0))
389    private static native void drawDetectedCornersCharuco_0(long image_nativeObj, long charucoCorners_nativeObj, long charucoIds_nativeObj, double cornerColor_val0, double cornerColor_val1, double cornerColor_val2, double cornerColor_val3);
390    private static native void drawDetectedCornersCharuco_1(long image_nativeObj, long charucoCorners_nativeObj, long charucoIds_nativeObj);
391    private static native void drawDetectedCornersCharuco_2(long image_nativeObj, long charucoCorners_nativeObj);
392
393    // C++:  void cv::aruco::drawDetectedDiamonds(Mat& image, vector_Mat diamondCorners, Mat diamondIds = Mat(), Scalar borderColor = Scalar(0, 0, 255))
394    private static native void drawDetectedDiamonds_0(long image_nativeObj, long diamondCorners_mat_nativeObj, long diamondIds_nativeObj, double borderColor_val0, double borderColor_val1, double borderColor_val2, double borderColor_val3);
395    private static native void drawDetectedDiamonds_1(long image_nativeObj, long diamondCorners_mat_nativeObj, long diamondIds_nativeObj);
396    private static native void drawDetectedDiamonds_2(long image_nativeObj, long diamondCorners_mat_nativeObj);
397
398    // C++:  Dictionary cv::aruco::getPredefinedDictionary(int dict)
399    private static native long getPredefinedDictionary_0(int dict);
400
401    // C++:  Dictionary cv::aruco::extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary = Dictionary(), int randomSeed = 0)
402    private static native long extendDictionary_0(int nMarkers, int markerSize, long baseDictionary_nativeObj, int randomSeed);
403    private static native long extendDictionary_1(int nMarkers, int markerSize, long baseDictionary_nativeObj);
404    private static native long extendDictionary_2(int nMarkers, int markerSize);
405
406}