Trait ArucoDetectorTraitConst

Source
pub trait ArucoDetectorTraitConst: AlgorithmTraitConst {
    // Required method
    fn as_raw_ArucoDetector(&self) -> *const c_void;

    // Provided methods
    fn detect_markers(
        &self,
        image: &impl ToInputArray,
        corners: &mut impl ToOutputArray,
        ids: &mut impl ToOutputArray,
        rejected_img_points: &mut impl ToOutputArray,
    ) -> Result<()> { ... }
    fn detect_markers_def(
        &self,
        image: &impl ToInputArray,
        corners: &mut impl ToOutputArray,
        ids: &mut impl ToOutputArray,
    ) -> Result<()> { ... }
    fn refine_detected_markers(
        &self,
        image: &impl ToInputArray,
        board: &impl BoardTraitConst,
        detected_corners: &mut impl ToInputOutputArray,
        detected_ids: &mut impl ToInputOutputArray,
        rejected_corners: &mut impl ToInputOutputArray,
        camera_matrix: &impl ToInputArray,
        dist_coeffs: &impl ToInputArray,
        recovered_idxs: &mut impl ToOutputArray,
    ) -> Result<()> { ... }
    fn refine_detected_markers_def(
        &self,
        image: &impl ToInputArray,
        board: &impl BoardTraitConst,
        detected_corners: &mut impl ToInputOutputArray,
        detected_ids: &mut impl ToInputOutputArray,
        rejected_corners: &mut impl ToInputOutputArray,
    ) -> Result<()> { ... }
    fn get_dictionary(&self) -> Result<Dictionary> { ... }
    fn get_detector_parameters(&self) -> Result<DetectorParameters> { ... }
    fn get_refine_parameters(&self) -> Result<RefineParameters> { ... }
    fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()> { ... }
}
Expand description

Constant methods for crate::objdetect::ArucoDetector

Required Methods§

Provided Methods§

Source

fn detect_markers( &self, image: &impl ToInputArray, corners: &mut impl ToOutputArray, ids: &mut impl ToOutputArray, rejected_img_points: &mut impl ToOutputArray, ) -> Result<()>

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::vectorcv::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). 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 corresponding camera model, if camera parameters are known

§See also

undistort, estimatePoseSingleMarkers, estimatePoseBoard

§C++ default parameters
  • rejected_img_points: noArray()
Source

fn detect_markers_def( &self, image: &impl ToInputArray, corners: &mut impl ToOutputArray, ids: &mut impl ToOutputArray, ) -> Result<()>

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::vectorcv::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). 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 corresponding camera model, if camera parameters are known

§See also

undistort, estimatePoseSingleMarkers, estimatePoseBoard

§Note

This alternative version of ArucoDetectorTraitConst::detect_markers function uses the following default values for its arguments:

  • rejected_img_points: noArray()
Source

fn refine_detected_markers( &self, image: &impl ToInputArray, board: &impl BoardTraitConst, detected_corners: &mut impl ToInputOutputArray, detected_ids: &mut impl ToInputOutputArray, rejected_corners: &mut impl ToInputOutputArray, camera_matrix: &impl ToInputArray, dist_coeffs: &impl ToInputArray, recovered_idxs: &mut impl ToOutputArray, ) -> Result<()>

Refine 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 inline formula
  • distCoeffs: optional vector of distortion coefficients inline formula 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.

§C++ default parameters
  • camera_matrix: noArray()
  • dist_coeffs: noArray()
  • recovered_idxs: noArray()
Source

fn refine_detected_markers_def( &self, image: &impl ToInputArray, board: &impl BoardTraitConst, detected_corners: &mut impl ToInputOutputArray, detected_ids: &mut impl ToInputOutputArray, rejected_corners: &mut impl ToInputOutputArray, ) -> Result<()>

Refine 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 inline formula
  • distCoeffs: optional vector of distortion coefficients inline formula 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.

§Note

This alternative version of ArucoDetectorTraitConst::refine_detected_markers function uses the following default values for its arguments:

  • camera_matrix: noArray()
  • dist_coeffs: noArray()
  • recovered_idxs: noArray()
Source

fn get_dictionary(&self) -> Result<Dictionary>

Source

fn get_detector_parameters(&self) -> Result<DetectorParameters>

Source

fn get_refine_parameters(&self) -> Result<RefineParameters>

Source

fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>

Stores algorithm parameters in a file storage

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§