Class ArucoDetector


  • public class ArucoDetector
    extends Algorithm
    The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method. After detecting some markers in the image, you can try to find undetected markers from this dictionary with refineDetectedMarkers() method. SEE: DetectorParameters, RefineParameters
    • Constructor Detail

      • ArucoDetector

        protected ArucoDetector​(long addr)
      • ArucoDetector

        public ArucoDetector​(Dictionary _dictionary,
                             DetectorParameters _params,
                             RefineParameters _refineParams)
        Basic ArucoDetector constructor
        Parameters:
        _dictionary - indicates the type of markers that will be searched
        _params - marker detection parameters
        _refineParams - marker refine detection parameters
      • ArucoDetector

        public ArucoDetector​(Dictionary _dictionary,
                             DetectorParameters _params)
        Basic ArucoDetector constructor
        Parameters:
        _dictionary - indicates the type of markers that will be searched
        _params - marker detection parameters
      • ArucoDetector

        public ArucoDetector​(Dictionary _dictionary)
        Basic ArucoDetector constructor
        Parameters:
        _dictionary - indicates the type of markers that will be searched
      • ArucoDetector

        public ArucoDetector()
        Basic ArucoDetector constructor
    • Method Detail

      • __fromPtr__

        public static ArucoDetector __fromPtr__​(long addr)
      • detectMarkers

        public void detectMarkers​(Mat image,
                                  java.util.List<Mat> corners,
                                  Mat ids,
                                  java.util.List<Mat> rejectedImgPoints)
        Basic marker detection
        Parameters:
        image - input image
        corners - vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
        ids - vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector<int>). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.
        rejectedImgPoints - contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes. Performs marker detection in the input image. Only markers included in the specific dictionary are searched. For each detected marker, it returns the 2D position of its corner in the image and its corresponding identifier. Note that this function does not perform pose estimation. Note: The function does not correct lens distortion or takes it into account. It's recommended to undistort input image with corresponging camera model, if camera parameters are known SEE: undistort, estimatePoseSingleMarkers, estimatePoseBoard
      • detectMarkers

        public void detectMarkers​(Mat image,
                                  java.util.List<Mat> corners,
                                  Mat ids)
        Basic marker detection
        Parameters:
        image - input image
        corners - vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
        ids - vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector<int>). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array. correct codification. Useful for debugging purposes. Performs marker detection in the input image. Only markers included in the specific dictionary are searched. For each detected marker, it returns the 2D position of its corner in the image and its corresponding identifier. Note that this function does not perform pose estimation. Note: The function does not correct lens distortion or takes it into account. It's recommended to undistort input image with corresponging camera model, if camera parameters are known SEE: undistort, estimatePoseSingleMarkers, estimatePoseBoard
      • refineDetectedMarkers

        public void refineDetectedMarkers​(Mat image,
                                          Board board,
                                          java.util.List<Mat> detectedCorners,
                                          Mat detectedIds,
                                          java.util.List<Mat> rejectedCorners,
                                          Mat cameraMatrix,
                                          Mat distCoeffs,
                                          Mat recoveredIdxs)
        Refind not detected markers based on the already detected and the board layout
        Parameters:
        image - input image
        board - layout of markers in the board.
        detectedCorners - vector of already detected marker corners.
        detectedIds - vector of already detected marker identifiers.
        rejectedCorners - vector of rejected candidates during the marker detection process.
        cameraMatrix - optional input 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\)
        distCoeffs - optional vector of distortion coefficients \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements
        recoveredIdxs - Optional array to returns the indexes of the recovered candidates in the original rejectedCorners array. This function tries to find markers that were not detected in the basic detecMarkers function. First, based on the current detected marker and the board layout, the function interpolates the position of the missing markers. Then it tries to find correspondence between the reprojected markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. If camera parameters and distortion coefficients are provided, missing markers are reprojected using projectPoint function. If not, missing marker projections are interpolated using global homography, and all the marker corners in the board must have the same Z coordinate.
      • refineDetectedMarkers

        public void refineDetectedMarkers​(Mat image,
                                          Board board,
                                          java.util.List<Mat> detectedCorners,
                                          Mat detectedIds,
                                          java.util.List<Mat> rejectedCorners,
                                          Mat cameraMatrix,
                                          Mat distCoeffs)
        Refind not detected markers based on the already detected and the board layout
        Parameters:
        image - input image
        board - layout of markers in the board.
        detectedCorners - vector of already detected marker corners.
        detectedIds - vector of already detected marker identifiers.
        rejectedCorners - vector of rejected candidates during the marker detection process.
        cameraMatrix - optional input 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\)
        distCoeffs - optional vector of distortion coefficients \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements original rejectedCorners array. This function tries to find markers that were not detected in the basic detecMarkers function. First, based on the current detected marker and the board layout, the function interpolates the position of the missing markers. Then it tries to find correspondence between the reprojected markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. If camera parameters and distortion coefficients are provided, missing markers are reprojected using projectPoint function. If not, missing marker projections are interpolated using global homography, and all the marker corners in the board must have the same Z coordinate.
      • refineDetectedMarkers

        public void refineDetectedMarkers​(Mat image,
                                          Board board,
                                          java.util.List<Mat> detectedCorners,
                                          Mat detectedIds,
                                          java.util.List<Mat> rejectedCorners,
                                          Mat cameraMatrix)
        Refind not detected markers based on the already detected and the board layout
        Parameters:
        image - input image
        board - layout of markers in the board.
        detectedCorners - vector of already detected marker corners.
        detectedIds - vector of already detected marker identifiers.
        rejectedCorners - vector of rejected candidates during the marker detection process.
        cameraMatrix - optional input 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\) \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements original rejectedCorners array. This function tries to find markers that were not detected in the basic detecMarkers function. First, based on the current detected marker and the board layout, the function interpolates the position of the missing markers. Then it tries to find correspondence between the reprojected markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. If camera parameters and distortion coefficients are provided, missing markers are reprojected using projectPoint function. If not, missing marker projections are interpolated using global homography, and all the marker corners in the board must have the same Z coordinate.
      • refineDetectedMarkers

        public void refineDetectedMarkers​(Mat image,
                                          Board board,
                                          java.util.List<Mat> detectedCorners,
                                          Mat detectedIds,
                                          java.util.List<Mat> rejectedCorners)
        Refind not detected markers based on the already detected and the board layout
        Parameters:
        image - input image
        board - layout of markers in the board.
        detectedCorners - vector of already detected marker corners.
        detectedIds - vector of already detected marker identifiers.
        rejectedCorners - vector of rejected candidates during the marker detection process. \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\) \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements original rejectedCorners array. This function tries to find markers that were not detected in the basic detecMarkers function. First, based on the current detected marker and the board layout, the function interpolates the position of the missing markers. Then it tries to find correspondence between the reprojected markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. If camera parameters and distortion coefficients are provided, missing markers are reprojected using projectPoint function. If not, missing marker projections are interpolated using global homography, and all the marker corners in the board must have the same Z coordinate.
      • write

        public void write​(java.lang.String fileName)
        simplified API for language bindings
        Parameters:
        fileName - automatically generated
      • get_dictionary

        public Dictionary get_dictionary()
      • set_dictionary

        public void set_dictionary​(Dictionary dictionary)
      • set_refineParams

        public void set_refineParams​(RefineParameters refineParams)
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class Algorithm
        Throws:
        java.lang.Throwable