Exemple #1
0
 /// <summary>
 /// Draw the matched keypoints between the model image and the observed image.
 /// </summary>
 /// <param name="modelImage">The model image</param>
 /// <param name="modelKeypoints">The keypoints in the model image</param>
 /// <param name="observedImage">The observed image</param>
 /// <param name="observedKeyPoints">The keypoints in the observed image</param>
 /// <param name="matchColor">The color for the match correspondence lines</param>
 /// <param name="singlePointColor">The color for highlighting the keypoints</param>
 /// <param name="mask">The mask for the matches. Use null for all matches.</param>
 /// <param name="flags">The drawing type</param>
 /// <param name="result">The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag</param>
 /// <param name="matches">Matches. Each matches[i] is k or less matches for the same query descriptor.</param>
 public static void DrawMatches(
     IInputArray modelImage,
     VectorOfKeyPoint modelKeypoints,
     IInputArray observedImage,
     VectorOfKeyPoint observedKeyPoints,
     VectorOfVectorOfDMatch matches,
     IInputOutputArray result,
     MCvScalar matchColor,
     MCvScalar singlePointColor,
     VectorOfVectorOfByte mask = null,
     KeypointDrawType flags    = KeypointDrawType.Default)
 {
     using (InputArray iaModelImage = modelImage.GetInputArray())
         using (InputArray iaObservedImage = observedImage.GetInputArray())
             using (InputOutputArray ioaResult = result.GetInputOutputArray())
                 Features2DInvoke.drawMatchedFeatures2(
                     iaObservedImage,
                     observedKeyPoints,
                     iaModelImage,
                     modelKeypoints,
                     matches,
                     ioaResult,
                     ref matchColor,
                     ref singlePointColor,
                     mask,
                     flags);
 }
 private static extern void drawMatchedFeatures(
     IntPtr img1, IntPtr keypoints1,
     IntPtr img2, IntPtr keypoints2,
     IntPtr matchIndices,
     IntPtr outImg,
     MCvScalar matchColor, MCvScalar singlePointColor,
     IntPtr matchesMask,
     KeypointDrawType flags);
        /// <summary>
        /// Draw the matched keypoints between the model image and the observered image.
        /// </summary>
        /// <param name="modelImage">The model image</param>
        /// <param name="modelKeypoints">The keypoints in the model image</param>
        /// <param name="observerdImage">The observed image</param>
        /// <param name="observedKeyPoints">The keypoints in the observed image</param>
        /// <param name="matchIndices">The match indices</param>
        /// <param name="matchColor">The color for the match correspondence lines</param>
        /// <param name="singlePointColor">The color for highlighting the keypoints</param>
        /// <param name="matchesMask">The mask for the matches. Use null for all matches.</param>
        /// <param name="flags">The drawing type</param>
        /// <returns>The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag</returns>
        public static Image <Bgr, Byte> DrawMatches(
            Image <Gray, Byte> modelImage, VectorOfKeyPoint modelKeypoints,
            Image <Gray, Byte> observerdImage, VectorOfKeyPoint observedKeyPoints,
            Matrix <int> matchIndices, Bgr matchColor, Bgr singlePointColor,
            Matrix <Byte> matchesMask, KeypointDrawType flags)
        {
            Image <Bgr, Byte> result = new Image <Bgr, byte>(modelImage.Cols + observerdImage.Cols, Math.Max(modelImage.Rows, observerdImage.Rows));

            drawMatchedFeatures(observerdImage, observedKeyPoints, modelImage, modelKeypoints, matchIndices, result, matchColor.MCvScalar, singlePointColor.MCvScalar, matchesMask, flags);
            return(result);
        }
 /// <summary>
 /// Draw the matched keypoints between the model image and the observered image.
 /// </summary>
 /// <param name="modelImage">The model image</param>
 /// <param name="modelKeypoints">The keypoints in the model image</param>
 /// <param name="observerdImage">The observed image</param>
 /// <param name="observedKeyPoints">The keypoints in the observed image</param>
 /// <param name="matchColor">The color for the match correspondence lines</param>
 /// <param name="singlePointColor">The color for highlighting the keypoints</param>
 /// <param name="mask">The mask for the matches. Use null for all matches.</param>
 /// <param name="flags">The drawing type</param>
 /// <param name="result">The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag</param>
 /// <param name="matches">Matches. Each matches[i] is k or less matches for the same query descriptor.</param>
 public static void DrawMatches(
    IInputArray modelImage, VectorOfKeyPoint modelKeypoints,
    IInputArray observerdImage, VectorOfKeyPoint observedKeyPoints,
    VectorOfVectorOfDMatch matches,
    IInputOutputArray result,
    MCvScalar matchColor, MCvScalar singlePointColor,
    IInputArray mask = null,
    KeypointDrawType flags = KeypointDrawType.Default)
 {
    using (InputArray iaModelImage = modelImage.GetInputArray())
    using (InputArray iaObserverdImage = observerdImage.GetInputArray())
    using (InputOutputArray ioaResult = result.GetInputOutputArray())
    using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
    CvInvoke.drawMatchedFeatures(iaObserverdImage, observedKeyPoints, iaModelImage,
       modelKeypoints, matches, ioaResult, ref matchColor, ref singlePointColor, iaMask , flags);
 }
 private static extern void drawMatchedFeatures(
                         IntPtr img1, IntPtr keypoints1,
                         IntPtr img2, IntPtr keypoints2,
                         IntPtr matchIndices,
                         IntPtr outImg,
                         MCvScalar matchColor, MCvScalar singlePointColor,
                         IntPtr matchesMask,
                         KeypointDrawType flags);
 /// <summary>
 /// Draw the matched keypoints between the model image and the observered image.
 /// </summary>
 /// <param name="modelImage">The model image</param>
 /// <param name="modelKeypoints">The keypoints in the model image</param>
 /// <param name="observerdImage">The observed image</param>
 /// <param name="observedKeyPoints">The keypoints in the observed image</param>
 /// <param name="matchIndices">The match indices</param>
 /// <param name="matchColor">The color for the match correspondence lines</param>
 /// <param name="singlePointColor">The color for highlighting the keypoints</param>
 /// <param name="matchesMask">The mask for the matches. Use null for all matches.</param>
 /// <param name="flags">The drawing type</param>
 /// <returns>The image where model and observed image is displayed side by side. Matches are drawn as indicated by the flag</returns>
 public static Image<Bgr, Byte> DrawMatches(
  Image<Gray, Byte> modelImage, VectorOfKeyPoint modelKeypoints,
  Image<Gray, Byte> observerdImage, VectorOfKeyPoint observedKeyPoints,
  Matrix<int> matchIndices, Bgr matchColor, Bgr singlePointColor,
  Matrix<Byte> matchesMask, KeypointDrawType flags)
 {
     Image<Bgr, Byte> result = new Image<Bgr, byte>(modelImage.Cols + observerdImage.Cols, Math.Max(modelImage.Rows, observerdImage.Rows));
      drawMatchedFeatures(observerdImage, observedKeyPoints, modelImage, modelKeypoints, matchIndices, result, matchColor.MCvScalar, singlePointColor.MCvScalar, matchesMask, flags);
      return result;
 }