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.Algorithm;
009import org.opencv.core.Mat;
010import org.opencv.objdetect.CharucoBoard;
011import org.opencv.objdetect.CharucoParameters;
012import org.opencv.objdetect.DetectorParameters;
013import org.opencv.objdetect.RefineParameters;
014import org.opencv.utils.Converters;
015
016// C++: class CharucoDetector
017
018public class CharucoDetector extends Algorithm {
019
020    protected CharucoDetector(long addr) { super(addr); }
021
022    // internal usage only
023    public static CharucoDetector __fromPtr__(long addr) { return new CharucoDetector(addr); }
024
025    //
026    // C++:   cv::aruco::CharucoDetector::CharucoDetector(CharucoBoard board, CharucoParameters charucoParams = CharucoParameters(), DetectorParameters detectorParams = DetectorParameters(), RefineParameters refineParams = RefineParameters())
027    //
028
029    /**
030     * Basic CharucoDetector constructor
031     *
032     * @param board ChAruco board
033     * @param charucoParams charuco detection parameters
034     * @param detectorParams marker detection parameters
035     * @param refineParams marker refine detection parameters
036     */
037    public CharucoDetector(CharucoBoard board, CharucoParameters charucoParams, DetectorParameters detectorParams, RefineParameters refineParams) {
038        super(CharucoDetector_0(board.nativeObj, charucoParams.nativeObj, detectorParams.nativeObj, refineParams.nativeObj));
039    }
040
041    /**
042     * Basic CharucoDetector constructor
043     *
044     * @param board ChAruco board
045     * @param charucoParams charuco detection parameters
046     * @param detectorParams marker detection parameters
047     */
048    public CharucoDetector(CharucoBoard board, CharucoParameters charucoParams, DetectorParameters detectorParams) {
049        super(CharucoDetector_1(board.nativeObj, charucoParams.nativeObj, detectorParams.nativeObj));
050    }
051
052    /**
053     * Basic CharucoDetector constructor
054     *
055     * @param board ChAruco board
056     * @param charucoParams charuco detection parameters
057     */
058    public CharucoDetector(CharucoBoard board, CharucoParameters charucoParams) {
059        super(CharucoDetector_2(board.nativeObj, charucoParams.nativeObj));
060    }
061
062    /**
063     * Basic CharucoDetector constructor
064     *
065     * @param board ChAruco board
066     */
067    public CharucoDetector(CharucoBoard board) {
068        super(CharucoDetector_3(board.nativeObj));
069    }
070
071
072    //
073    // C++:  CharucoBoard cv::aruco::CharucoDetector::getBoard()
074    //
075
076    public CharucoBoard getBoard() {
077        return new CharucoBoard(getBoard_0(nativeObj));
078    }
079
080
081    //
082    // C++:  void cv::aruco::CharucoDetector::setBoard(CharucoBoard board)
083    //
084
085    public void setBoard(CharucoBoard board) {
086        setBoard_0(nativeObj, board.nativeObj);
087    }
088
089
090    //
091    // C++:  CharucoParameters cv::aruco::CharucoDetector::getCharucoParameters()
092    //
093
094    public CharucoParameters getCharucoParameters() {
095        return new CharucoParameters(getCharucoParameters_0(nativeObj));
096    }
097
098
099    //
100    // C++:  void cv::aruco::CharucoDetector::setCharucoParameters(CharucoParameters charucoParameters)
101    //
102
103    public void setCharucoParameters(CharucoParameters charucoParameters) {
104        setCharucoParameters_0(nativeObj, charucoParameters.nativeObj);
105    }
106
107
108    //
109    // C++:  DetectorParameters cv::aruco::CharucoDetector::getDetectorParameters()
110    //
111
112    public DetectorParameters getDetectorParameters() {
113        return new DetectorParameters(getDetectorParameters_0(nativeObj));
114    }
115
116
117    //
118    // C++:  void cv::aruco::CharucoDetector::setDetectorParameters(DetectorParameters detectorParameters)
119    //
120
121    public void setDetectorParameters(DetectorParameters detectorParameters) {
122        setDetectorParameters_0(nativeObj, detectorParameters.nativeObj);
123    }
124
125
126    //
127    // C++:  RefineParameters cv::aruco::CharucoDetector::getRefineParameters()
128    //
129
130    public RefineParameters getRefineParameters() {
131        return new RefineParameters(getRefineParameters_0(nativeObj));
132    }
133
134
135    //
136    // C++:  void cv::aruco::CharucoDetector::setRefineParameters(RefineParameters refineParameters)
137    //
138
139    public void setRefineParameters(RefineParameters refineParameters) {
140        setRefineParameters_0(nativeObj, refineParameters.nativeObj);
141    }
142
143
144    //
145    // C++:  void cv::aruco::CharucoDetector::detectBoard(Mat image, Mat& charucoCorners, Mat& charucoIds, vector_Mat& markerCorners = vector_Mat(), Mat& markerIds = Mat())
146    //
147
148    /**
149     * detect aruco markers and interpolate position of ChArUco board corners
150     * @param image input image necesary for corner refinement. Note that markers are not detected and
151     * should be sent in corners and ids parameters.
152     * @param charucoCorners interpolated chessboard corners.
153     * @param charucoIds interpolated chessboard corners identifiers.
154     * @param markerCorners vector of already detected markers corners. For each marker, its four
155     * corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the
156     * dimensions of this array should be Nx4. The order of the corners should be clockwise.
157     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
158     * @param markerIds list of identifiers for each marker in corners.
159     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
160     *
161     * This function receives the detected markers and returns the 2D position of the chessboard corners
162     * from a ChArUco board using the detected Aruco markers.
163     *
164     * If markerCorners and markerCorners are empty, the detectMarkers() will run and detect aruco markers and ids.
165     *
166     * If camera parameters are provided, the process is based in an approximated pose estimation, else it is based on local homography.
167     * Only visible corners are returned. For each corner, its corresponding identifier is also returned in charucoIds.
168     * SEE: findChessboardCorners
169     */
170    public void detectBoard(Mat image, Mat charucoCorners, Mat charucoIds, List<Mat> markerCorners, Mat markerIds) {
171        Mat markerCorners_mat = Converters.vector_Mat_to_Mat(markerCorners);
172        detectBoard_0(nativeObj, image.nativeObj, charucoCorners.nativeObj, charucoIds.nativeObj, markerCorners_mat.nativeObj, markerIds.nativeObj);
173        Converters.Mat_to_vector_Mat(markerCorners_mat, markerCorners);
174        markerCorners_mat.release();
175    }
176
177    /**
178     * detect aruco markers and interpolate position of ChArUco board corners
179     * @param image input image necesary for corner refinement. Note that markers are not detected and
180     * should be sent in corners and ids parameters.
181     * @param charucoCorners interpolated chessboard corners.
182     * @param charucoIds interpolated chessboard corners identifiers.
183     * @param markerCorners vector of already detected markers corners. For each marker, its four
184     * corners are provided, (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers, the
185     * dimensions of this array should be Nx4. The order of the corners should be clockwise.
186     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
187     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
188     *
189     * This function receives the detected markers and returns the 2D position of the chessboard corners
190     * from a ChArUco board using the detected Aruco markers.
191     *
192     * If markerCorners and markerCorners are empty, the detectMarkers() will run and detect aruco markers and ids.
193     *
194     * If camera parameters are provided, the process is based in an approximated pose estimation, else it is based on local homography.
195     * Only visible corners are returned. For each corner, its corresponding identifier is also returned in charucoIds.
196     * SEE: findChessboardCorners
197     */
198    public void detectBoard(Mat image, Mat charucoCorners, Mat charucoIds, List<Mat> markerCorners) {
199        Mat markerCorners_mat = Converters.vector_Mat_to_Mat(markerCorners);
200        detectBoard_1(nativeObj, image.nativeObj, charucoCorners.nativeObj, charucoIds.nativeObj, markerCorners_mat.nativeObj);
201        Converters.Mat_to_vector_Mat(markerCorners_mat, markerCorners);
202        markerCorners_mat.release();
203    }
204
205    /**
206     * detect aruco markers and interpolate position of ChArUco board corners
207     * @param image input image necesary for corner refinement. Note that markers are not detected and
208     * should be sent in corners and ids parameters.
209     * @param charucoCorners interpolated chessboard corners.
210     * @param charucoIds interpolated chessboard corners identifiers.
211     * corners are provided, (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ). For N detected markers, the
212     * dimensions of this array should be Nx4. The order of the corners should be clockwise.
213     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
214     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
215     *
216     * This function receives the detected markers and returns the 2D position of the chessboard corners
217     * from a ChArUco board using the detected Aruco markers.
218     *
219     * If markerCorners and markerCorners are empty, the detectMarkers() will run and detect aruco markers and ids.
220     *
221     * If camera parameters are provided, the process is based in an approximated pose estimation, else it is based on local homography.
222     * Only visible corners are returned. For each corner, its corresponding identifier is also returned in charucoIds.
223     * SEE: findChessboardCorners
224     */
225    public void detectBoard(Mat image, Mat charucoCorners, Mat charucoIds) {
226        detectBoard_2(nativeObj, image.nativeObj, charucoCorners.nativeObj, charucoIds.nativeObj);
227    }
228
229
230    //
231    // C++:  void cv::aruco::CharucoDetector::detectDiamonds(Mat image, vector_Mat& diamondCorners, Mat& diamondIds, vector_Mat& markerCorners = vector_Mat(), Mat& markerIds = Mat())
232    //
233
234    /**
235     * Detect ChArUco Diamond markers
236     *
237     * @param image input image necessary for corner subpixel.
238     * @param diamondCorners output list of detected diamond corners (4 corners per diamond). The order
239     * is the same than in marker corners: top left, top right, bottom right and bottom left. Similar
240     * format than the corners returned by detectMarkers (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ).
241     * @param diamondIds ids of the diamonds in diamondCorners. The id of each diamond is in fact of
242     * type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the
243     * diamond.
244     * @param markerCorners list of detected marker corners from detectMarkers function.
245     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
246     * @param markerIds list of marker ids in markerCorners.
247     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
248     *
249     * This function detects Diamond markers from the previous detected ArUco markers. The diamonds
250     * are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters
251     * are provided, the diamond search is based on reprojection. If not, diamond search is based on
252     * homography. Homography is faster than reprojection, but less accurate.
253     */
254    public void detectDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds, List<Mat> markerCorners, Mat markerIds) {
255        Mat diamondCorners_mat = new Mat();
256        Mat markerCorners_mat = Converters.vector_Mat_to_Mat(markerCorners);
257        detectDiamonds_0(nativeObj, image.nativeObj, diamondCorners_mat.nativeObj, diamondIds.nativeObj, markerCorners_mat.nativeObj, markerIds.nativeObj);
258        Converters.Mat_to_vector_Mat(diamondCorners_mat, diamondCorners);
259        diamondCorners_mat.release();
260        Converters.Mat_to_vector_Mat(markerCorners_mat, markerCorners);
261        markerCorners_mat.release();
262    }
263
264    /**
265     * Detect ChArUco Diamond markers
266     *
267     * @param image input image necessary for corner subpixel.
268     * @param diamondCorners output list of detected diamond corners (4 corners per diamond). The order
269     * is the same than in marker corners: top left, top right, bottom right and bottom left. Similar
270     * format than the corners returned by detectMarkers (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ).
271     * @param diamondIds ids of the diamonds in diamondCorners. The id of each diamond is in fact of
272     * type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the
273     * diamond.
274     * @param markerCorners list of detected marker corners from detectMarkers function.
275     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
276     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
277     *
278     * This function detects Diamond markers from the previous detected ArUco markers. The diamonds
279     * are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters
280     * are provided, the diamond search is based on reprojection. If not, diamond search is based on
281     * homography. Homography is faster than reprojection, but less accurate.
282     */
283    public void detectDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds, List<Mat> markerCorners) {
284        Mat diamondCorners_mat = new Mat();
285        Mat markerCorners_mat = Converters.vector_Mat_to_Mat(markerCorners);
286        detectDiamonds_1(nativeObj, image.nativeObj, diamondCorners_mat.nativeObj, diamondIds.nativeObj, markerCorners_mat.nativeObj);
287        Converters.Mat_to_vector_Mat(diamondCorners_mat, diamondCorners);
288        diamondCorners_mat.release();
289        Converters.Mat_to_vector_Mat(markerCorners_mat, markerCorners);
290        markerCorners_mat.release();
291    }
292
293    /**
294     * Detect ChArUco Diamond markers
295     *
296     * @param image input image necessary for corner subpixel.
297     * @param diamondCorners output list of detected diamond corners (4 corners per diamond). The order
298     * is the same than in marker corners: top left, top right, bottom right and bottom left. Similar
299     * format than the corners returned by detectMarkers (e.g std::vector&lt;std::vector&lt;cv::Point2f&gt; &gt; ).
300     * @param diamondIds ids of the diamonds in diamondCorners. The id of each diamond is in fact of
301     * type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the
302     * diamond.
303     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
304     * If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
305     *
306     * This function detects Diamond markers from the previous detected ArUco markers. The diamonds
307     * are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters
308     * are provided, the diamond search is based on reprojection. If not, diamond search is based on
309     * homography. Homography is faster than reprojection, but less accurate.
310     */
311    public void detectDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds) {
312        Mat diamondCorners_mat = new Mat();
313        detectDiamonds_2(nativeObj, image.nativeObj, diamondCorners_mat.nativeObj, diamondIds.nativeObj);
314        Converters.Mat_to_vector_Mat(diamondCorners_mat, diamondCorners);
315        diamondCorners_mat.release();
316    }
317
318
319    @Override
320    protected void finalize() throws Throwable {
321        delete(nativeObj);
322    }
323
324
325
326    // C++:   cv::aruco::CharucoDetector::CharucoDetector(CharucoBoard board, CharucoParameters charucoParams = CharucoParameters(), DetectorParameters detectorParams = DetectorParameters(), RefineParameters refineParams = RefineParameters())
327    private static native long CharucoDetector_0(long board_nativeObj, long charucoParams_nativeObj, long detectorParams_nativeObj, long refineParams_nativeObj);
328    private static native long CharucoDetector_1(long board_nativeObj, long charucoParams_nativeObj, long detectorParams_nativeObj);
329    private static native long CharucoDetector_2(long board_nativeObj, long charucoParams_nativeObj);
330    private static native long CharucoDetector_3(long board_nativeObj);
331
332    // C++:  CharucoBoard cv::aruco::CharucoDetector::getBoard()
333    private static native long getBoard_0(long nativeObj);
334
335    // C++:  void cv::aruco::CharucoDetector::setBoard(CharucoBoard board)
336    private static native void setBoard_0(long nativeObj, long board_nativeObj);
337
338    // C++:  CharucoParameters cv::aruco::CharucoDetector::getCharucoParameters()
339    private static native long getCharucoParameters_0(long nativeObj);
340
341    // C++:  void cv::aruco::CharucoDetector::setCharucoParameters(CharucoParameters charucoParameters)
342    private static native void setCharucoParameters_0(long nativeObj, long charucoParameters_nativeObj);
343
344    // C++:  DetectorParameters cv::aruco::CharucoDetector::getDetectorParameters()
345    private static native long getDetectorParameters_0(long nativeObj);
346
347    // C++:  void cv::aruco::CharucoDetector::setDetectorParameters(DetectorParameters detectorParameters)
348    private static native void setDetectorParameters_0(long nativeObj, long detectorParameters_nativeObj);
349
350    // C++:  RefineParameters cv::aruco::CharucoDetector::getRefineParameters()
351    private static native long getRefineParameters_0(long nativeObj);
352
353    // C++:  void cv::aruco::CharucoDetector::setRefineParameters(RefineParameters refineParameters)
354    private static native void setRefineParameters_0(long nativeObj, long refineParameters_nativeObj);
355
356    // C++:  void cv::aruco::CharucoDetector::detectBoard(Mat image, Mat& charucoCorners, Mat& charucoIds, vector_Mat& markerCorners = vector_Mat(), Mat& markerIds = Mat())
357    private static native void detectBoard_0(long nativeObj, long image_nativeObj, long charucoCorners_nativeObj, long charucoIds_nativeObj, long markerCorners_mat_nativeObj, long markerIds_nativeObj);
358    private static native void detectBoard_1(long nativeObj, long image_nativeObj, long charucoCorners_nativeObj, long charucoIds_nativeObj, long markerCorners_mat_nativeObj);
359    private static native void detectBoard_2(long nativeObj, long image_nativeObj, long charucoCorners_nativeObj, long charucoIds_nativeObj);
360
361    // C++:  void cv::aruco::CharucoDetector::detectDiamonds(Mat image, vector_Mat& diamondCorners, Mat& diamondIds, vector_Mat& markerCorners = vector_Mat(), Mat& markerIds = Mat())
362    private static native void detectDiamonds_0(long nativeObj, long image_nativeObj, long diamondCorners_mat_nativeObj, long diamondIds_nativeObj, long markerCorners_mat_nativeObj, long markerIds_nativeObj);
363    private static native void detectDiamonds_1(long nativeObj, long image_nativeObj, long diamondCorners_mat_nativeObj, long diamondIds_nativeObj, long markerCorners_mat_nativeObj);
364    private static native void detectDiamonds_2(long nativeObj, long image_nativeObj, long diamondCorners_mat_nativeObj, long diamondIds_nativeObj);
365
366    // native support for java finalize()
367    private static native void delete(long nativeObj);
368
369}