Exemple #1
0
 /// <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);
    }
 }
Exemple #2
0
 internal static extern IntPtr cveArucoGetPredefinedDictionary(Dictionary.PredefinedDictionaryName name);
Exemple #3
0
      public void TestArucoCreateBoard()
      {
         Size imageSize = new Size();
         int markersX = 4;
         int markersY = 4;
         int markersLength = 80;
         int markersSeparation = 30;
         int margins = markersSeparation;
         imageSize.Width = markersX*(markersLength + markersSeparation) - markersSeparation + 2*margins;
         imageSize.Height = markersY*(markersLength + markersSeparation) - markersSeparation + 2*margins;
         int borderBits = 1;

         Aruco.Dictionary dictionary = new Dictionary(Dictionary.PredefinedDictionaryName.Dict4X4_100);
         Aruco.GridBoard board = new GridBoard(markersX, markersY, markersLength, markersSeparation, dictionary);
         Mat boardImage = new Mat();
         board.Draw(imageSize, boardImage, margins, borderBits);
         CvInvoke.Imwrite("board.png", boardImage);
      }
Exemple #4
0
 /// <summary>
 /// ChArUco board
 /// </summary>
 /// <param name="squaresX">number of chessboard squares in X direction</param>
 /// <param name="squaresY">number of chessboard squares in Y direction</param>
 /// <param name="squareLength">chessboard square side length (normally in meters)</param>
 /// <param name="markerLength">marker side length (same unit than squareLength)</param>
 /// <param name="dictionary">dictionary of markers indicating the type of markers.</param>
 public CharucoBoard(
    int squaresX, int squaresY,
    float squareLength, float markerLength,
    Dictionary dictionary)
 {
    _ptr = ArucoInvoke.cveCharucoBoardCreate(squaresX, squaresY, squareLength, markerLength, dictionary, ref _boardPtr);
 }
Exemple #5
0
 /// <summary>
 /// Create a GridBoard object.
 /// </summary>
 /// <param name="markersX">number of markers in X direction</param>
 /// <param name="markersY">number of markers in Y direction</param>
 /// <param name="markerLength">marker side length (normally in meters)</param>
 /// <param name="markerSeparation">separation between two markers (same unit than markerLenght)</param>
 /// <param name="dictionary">dictionary of markers indicating the type of markers. The first markersX*markersY markers in the dictionary are used.</param>
 public GridBoard(int markersX, int markersY, float markerLength, float markerSeparation,
    Dictionary dictionary)
 {
    _ptr = ArucoInvoke.cveArucoGridBoardCreate(markersX, markersY, markerLength, markerSeparation, dictionary, ref _boardPtr);
 }
Exemple #6
0
 /// <summary>
 /// Draw a canonical marker image.
 /// </summary>
 /// <param name="dict">dictionary of markers indicating the type of markers</param>
 /// <param name="id">identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.</param>
 /// <param name="sidePixels">size of the image in pixels</param>
 /// <param name="img">output image with the marker</param>
 /// <param name="borderBits">width of the marker border.</param>
 public static void DrawMarker(Dictionary dict, int id, int sidePixels, IOutputArray img, int borderBits = 1)
 {
    using (OutputArray oaImg = img.GetOutputArray())
       cveArucoDrawMarker(dict, id, sidePixels, oaImg, borderBits);
 }