/// <summary> /// Get the detector parameters with default values /// </summary> /// <returns>The default detector parameters</returns> public static DetectorParameters GetDefault() { DetectorParameters p = new DetectorParameters(); ArucoInvoke.cveArucoDetectorParametersGetDefault(ref p); return(p); }
internal static extern void cveArucoRefineDetectedMarkers( IntPtr image, IntPtr board, IntPtr detectedCorners, IntPtr detectedIds, IntPtr rejectedCorners, IntPtr cameraMatrix, IntPtr distCoeffs, float minRepDistance, float errorCorrectionRate, [MarshalAs(CvInvoke.BoolMarshalType)] bool checkAllOrders, IntPtr ecoveredIdxs, ref DetectorParameters parameters);
/// <summary> /// 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. /// </summary> /// <param name="image">input image</param> /// <param name="dict">indicates the type of markers that will be searched</param> /// <param name="corners"> vector of detected marker corners. For each marker, its four corners are provided, (e.g VectorOfVectorOfPointF ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.</param> /// <param name="ids">vector of identifiers of the detected markers. The identifier is of type int (e.g. VectorOfInt). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.</param> /// <param name="parameters">marker detection parameters</param> /// <param name="rejectedImgPoints">contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.</param> public static void DetectMarkers( IInputArray image, Dictionary dict, IOutputArrayOfArrays corners, IOutputArray ids, DetectorParameters parameters, IOutputArrayOfArrays rejectedImgPoints = null ) { using (InputArray iaImage = image.GetInputArray()) using (OutputArray oaCorners = corners.GetOutputArray()) using (OutputArray oaIds = ids.GetOutputArray()) using (OutputArray oaRejectedImgPoints = rejectedImgPoints != null ? rejectedImgPoints.GetOutputArray() : OutputArray.GetEmpty()) { cveArucoDetectMarkers(iaImage, dict, oaCorners, oaIds, ref parameters, oaRejectedImgPoints); } }
/// <summary> /// Refine not detected markers based on the already detected and the board layout. /// </summary> /// <param name="image">Input image</param> /// <param name="board">Layout of markers in the board.</param> /// <param name="detectedCorners">Vector of already detected marker corners.</param> /// <param name="detectedIds">Vector of already detected marker identifiers.</param> /// <param name="rejectedCorners">Vector of rejected candidates during the marker detection process</param> /// <param name="cameraMatrix">Optional input 3x3 floating-point camera matrix </param> /// <param name="distCoeffs">Optional vector of distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6],[s1,s2,s3,s4]]) of 4, 5, 8 or 12 elements</param> /// <param name="minRepDistance">Minimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence. (default 10)</param> /// <param name="errorCorrectionRate">Rate of allowed erroneous bits respect to the error correction capability of the used dictionary. -1 ignores the error correction step. (default 3)</param> /// <param name="checkAllOrders">Consider the four posible corner orders in the rejectedCorners array. If it set to false, only the provided corner order is considered (default true).</param> /// <param name="recoveredIdxs">Optional array to returns the indexes of the recovered candidates in the original rejectedCorners array.</param> /// <param name="parameters">marker detection parameters</param> public static void RefineDetectedMarkers( IInputArray image, IBoard board, IInputOutputArray detectedCorners, IInputOutputArray detectedIds, IInputOutputArray rejectedCorners, IInputArray cameraMatrix, IInputArray distCoeffs, float minRepDistance, float errorCorrectionRate, bool checkAllOrders, IOutputArray recoveredIdxs, DetectorParameters parameters) { using (InputArray iaImage = image.GetInputArray()) using (InputOutputArray ioaDetectedCorners = detectedCorners.GetInputOutputArray()) using (InputOutputArray ioaDetectedIds = detectedIds.GetInputOutputArray()) using (InputOutputArray ioaRejectedCorners = rejectedCorners.GetInputOutputArray()) using (InputArray iaCameraMatrix = cameraMatrix == null ? InputArray.GetEmpty() : cameraMatrix.GetInputArray()) using (InputArray iaDistCoeffs = distCoeffs == null ? InputArray.GetEmpty() : distCoeffs.GetInputArray()) using ( OutputArray oaRecovervedIdx = recoveredIdxs == null ? OutputArray.GetEmpty() : recoveredIdxs.GetOutputArray()) { cveArucoRefineDetectedMarkers(iaImage, board.BoardPtr, ioaDetectedCorners, ioaDetectedIds, ioaRejectedCorners, iaCameraMatrix, iaDistCoeffs, minRepDistance, errorCorrectionRate, checkAllOrders, oaRecovervedIdx, ref parameters); } }
internal static extern void cveArucoDetectMarkers(IntPtr image, IntPtr dictionary, IntPtr corners, IntPtr ids, ref DetectorParameters parameters, IntPtr rejectedImgPoints);
internal static extern void cveArucoDetectorParametersGetDefault(ref DetectorParameters parameters);
/// <summary> /// Get the detector parameters with default values /// </summary> /// <returns>The default detector parameters</returns> public static DetectorParameters GetDefault() { DetectorParameters p = new DetectorParameters(); ArucoInvoke.cveArucoDetectorParametersGetDefault(ref p); return p; }
/// <summary> /// Refind not detected markers based on the already detected and the board layout. /// </summary> /// <param name="image">Input image</param> /// <param name="board">Layout of markers in the board.</param> /// <param name="detectedCorners">Vector of already detected marker corners.</param> /// <param name="detectedIds">Vector of already detected marker identifiers.</param> /// <param name="rejectedCorners">Vector of rejected candidates during the marker detection process</param> /// <param name="cameraMatrix">Optional input 3x3 floating-point camera matrix </param> /// <param name="distCoeffs">Optional vector of distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6],[s1,s2,s3,s4]]) of 4, 5, 8 or 12 elements</param> /// <param name="minRepDistance">Minimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence. (default 10)</param> /// <param name="errorCorrectionRate">Rate of allowed erroneous bits respect to the error correction capability of the used dictionary. -1 ignores the error correction step. (default 3)</param> /// <param name="checkAllOrders">Consider the four posible corner orders in the rejectedCorners array. If it set to false, only the provided corner order is considered (default true).</param> /// <param name="recoveredIdxs">Optional array to returns the indexes of the recovered candidates in the original rejectedCorners array.</param> /// <param name="parameters">marker detection parameters</param> public static void RefineDetectedMarkers( IInputArray image, IBoard board, IInputOutputArray detectedCorners, IInputOutputArray detectedIds, IInputOutputArray rejectedCorners, IInputArray cameraMatrix, IInputArray distCoeffs, float minRepDistance, float errorCorrectionRate, bool checkAllOrders, IOutputArray recoveredIdxs, DetectorParameters parameters) { using (InputArray iaImage = image.GetInputArray()) using (InputOutputArray ioaDetectedCorners = detectedCorners.GetInputOutputArray()) using (InputOutputArray ioaDetectedIds = detectedIds.GetInputOutputArray()) using (InputOutputArray ioaRejectedCorners = rejectedCorners.GetInputOutputArray()) using (InputArray iaCameraMatrix = cameraMatrix == null ? InputArray.GetEmpty() : cameraMatrix.GetInputArray()) using (InputArray iaDistCoeffs = distCoeffs == null ? InputArray.GetEmpty() : distCoeffs.GetInputArray()) using ( OutputArray oaRecovervedIdx = recoveredIdxs == null ? OutputArray.GetEmpty() : recoveredIdxs.GetOutputArray()) { cveArucoRefineDetectedMarkers(iaImage, board.BoardPtr, ioaDetectedCorners, ioaDetectedIds, ioaRejectedCorners, iaCameraMatrix, iaDistCoeffs, minRepDistance, errorCorrectionRate, checkAllOrders, oaRecovervedIdx, ref parameters); } }