예제 #1
0
        //
        // C++:  void cv::xfeatures2d::matchLOGOS(vector_KeyPoint keypoints1, vector_KeyPoint keypoints2, vector_int nn1, vector_int nn2, vector_DMatch matches1to2)
        //

        /**
         * LOGOS (Local geometric support for high-outlier spatial verification) feature matching strategy described in CITE: Lowry2018LOGOSLG .
         *     param keypoints1 Input keypoints of image1.
         *     param keypoints2 Input keypoints of image2.
         *     param nn1 Index to the closest BoW centroid for each descriptors of image1.
         *     param nn2 Index to the closest BoW centroid for each descriptors of image2.
         *     param matches1to2 Matches returned by the LOGOS matching strategy.
         *     <b>Note:</b>
         *         This matching strategy is suitable for features matching against large scale database.
         *         First step consists in constructing the bag-of-words (BoW) from a representative image database.
         *         Image descriptors are then represented by their closest codevector (nearest BoW centroid).
         */
        public static void matchLOGOS(MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfInt nn1, MatOfInt nn2, MatOfDMatch matches1to2)
        {
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (nn1 != null)
            {
                nn1.ThrowIfDisposed();
            }
            if (nn2 != null)
            {
                nn2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat nn1_mat         = nn1;
            Mat nn2_mat         = nn2;
            Mat matches1to2_mat = matches1to2;

            xfeatures2d_Xfeatures2d_matchLOGOS_10(keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, nn1_mat.nativeObj, nn2_mat.nativeObj, matches1to2_mat.nativeObj);
        }
예제 #2
0
        //
        // C++:  void cv::DescriptorMatcher::match(Mat queryDescriptors, Mat trainDescriptors, vector_DMatch& matches, Mat mask = Mat())
        //

        //javadoc: DescriptorMatcher::match(queryDescriptors, trainDescriptors, matches, mask)
        public void match(Mat queryDescriptors, Mat trainDescriptors, MatOfDMatch matches, Mat mask)
        {
            ThrowIfDisposed();
            if (queryDescriptors != null)
            {
                queryDescriptors.ThrowIfDisposed();
            }
            if (trainDescriptors != null)
            {
                trainDescriptors.ThrowIfDisposed();
            }
            if (matches != null)
            {
                matches.ThrowIfDisposed();
            }
            if (mask != null)
            {
                mask.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat matches_mat = matches;
            features2d_DescriptorMatcher_match_10(nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, mask.nativeObj);

            return;
#else
            return;
#endif
        }
예제 #3
0
        /**
         * GMS (Grid-based Motion Statistics) feature matching strategy described in CITE: Bian2017gms .
         *     param size1 Input size of image1.
         *     param size2 Input size of image2.
         *     param keypoints1 Input keypoints of image1.
         *     param keypoints2 Input keypoints of image2.
         *     param matches1to2 Input 1-nearest neighbor matches.
         *     param matchesGMS Matches returned by the GMS matching strategy.
         *     param withRotation Take rotation transformation into account.
         *     param withScale Take scale transformation into account.
         *     <b>Note:</b>
         *         Since GMS works well when the number of features is large, we recommend to use the ORB feature and set FastThreshold to 0 to get as many as possible features quickly.
         *         If matching results are not satisfying, please add more features. (We use 10000 for images with 640 X 480).
         *         If your images have big rotation and scale changes, please set withRotation or withScale to true.
         */
        public static void matchGMS(Size size1, Size size2, MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, MatOfDMatch matchesGMS, bool withRotation, bool withScale)
        {
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (matchesGMS != null)
            {
                matchesGMS.ThrowIfDisposed();
            }
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;
            Mat matchesGMS_mat  = matchesGMS;

            xfeatures2d_Xfeatures2d_matchGMS_11(size1.width, size1.height, size2.width, size2.height, keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, matchesGMS_mat.nativeObj, withRotation, withScale);
        }
예제 #4
0
        /**
         * Draws the found matches of keypoints from two images.
         *
         * param img1 First source image.
         * param keypoints1 Keypoints from the first source image.
         * param img2 Second source image.
         * param keypoints2 Keypoints from the second source image.
         * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
         * has a corresponding point in keypoints2[matches[i]] .
         * param outImg Output image. Its content depends on the flags value defining what is drawn in the
         * output image. See possible flags bit values below.
         * , the color is generated randomly.
         * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
         * drawn.
         * DrawMatchesFlags.
         *
         * This function draws matches of keypoints from two images in the output image. Match is a line
         * connecting two keypoints (circles). See cv::DrawMatchesFlags.
         */
        public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg)
        {
            if (img1 != null)
            {
                img1.ThrowIfDisposed();
            }
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (img2 != null)
            {
                img2.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (outImg != null)
            {
                outImg.ThrowIfDisposed();
            }
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;

            features2d_Features2d_drawMatches_14(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
        }
예제 #5
0
        //javadoc: matchGMS(size1, size2, keypoints1, keypoints2, matches1to2, matchesGMS, withRotation)
        public static void matchGMS(Size size1, Size size2, MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, MatOfDMatch matchesGMS, bool withRotation)
        {
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (matchesGMS != null)
            {
                matchesGMS.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;
            Mat matchesGMS_mat  = matchesGMS;
            xfeatures2d_Xfeatures2d_matchGMS_12(size1.width, size1.height, size2.width, size2.height, keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, matchesGMS_mat.nativeObj, withRotation);

            return;
#else
            return;
#endif
        }
예제 #6
0
        /**
         * Draws the found matches of keypoints from two images.
         *
         * param img1 First source image.
         * param keypoints1 Keypoints from the first source image.
         * param img2 Second source image.
         * param keypoints2 Keypoints from the second source image.
         * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
         * has a corresponding point in keypoints2[matches[i]] .
         * param outImg Output image. Its content depends on the flags value defining what is drawn in the
         * output image. See possible flags bit values below.
         * param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
         * , the color is generated randomly.
         * param singlePointColor Color of single keypoints (circles), which means that keypoints do not
         * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
         * drawn.
         * DrawMatchesFlags.
         *
         * This function draws matches of keypoints from two images in the output image. Match is a line
         * connecting two keypoints (circles). See cv::DrawMatchesFlags.
         */
        public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor)
        {
            if (img1 != null)
            {
                img1.ThrowIfDisposed();
            }
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (img2 != null)
            {
                img2.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (outImg != null)
            {
                outImg.ThrowIfDisposed();
            }
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;

            features2d_Features2d_drawMatches_12(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3]);
        }
예제 #7
0
        /**
         *
         *     param queryDescriptors Query set of descriptors.
         *     param matches Matches. If a query descriptor is masked out in mask , no match is added for this
         *     descriptor. So, matches size may be smaller than the query descriptors count.
         *     descriptors and stored train descriptors from the i-th image trainDescCollection[i].
         */
        public void match(Mat queryDescriptors, MatOfDMatch matches)
        {
            ThrowIfDisposed();
            if (queryDescriptors != null)
            {
                queryDescriptors.ThrowIfDisposed();
            }
            if (matches != null)
            {
                matches.ThrowIfDisposed();
            }
            Mat matches_mat = matches;

            features2d_DescriptorMatcher_match_13(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj);
        }
예제 #8
0
        //
        // C++:  void cv::DescriptorMatcher::match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
        //

        /**
         *
         *     param queryDescriptors Query set of descriptors.
         *     param matches Matches. If a query descriptor is masked out in mask , no match is added for this
         *     descriptor. So, matches size may be smaller than the query descriptors count.
         *     param masks Set of masks. Each masks[i] specifies permissible matches between the input query
         *     descriptors and stored train descriptors from the i-th image trainDescCollection[i].
         */
        public void match(Mat queryDescriptors, MatOfDMatch matches, List <Mat> masks)
        {
            ThrowIfDisposed();
            if (queryDescriptors != null)
            {
                queryDescriptors.ThrowIfDisposed();
            }
            if (matches != null)
            {
                matches.ThrowIfDisposed();
            }
            Mat matches_mat = matches;
            Mat masks_mat   = Converters.vector_Mat_to_Mat(masks);

            features2d_DescriptorMatcher_match_12(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, masks_mat.nativeObj);
        }
예제 #9
0
        //
        // C++:  void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
        //

        //javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg, matchColor, singlePointColor, matchesMask)
        public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask)
        {
            if (img1 != null)
            {
                img1.ThrowIfDisposed();
            }
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (img2 != null)
            {
                img2.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (outImg != null)
            {
                outImg.ThrowIfDisposed();
            }
            if (matchesMask != null)
            {
                matchesMask.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;
            Mat matchesMask_mat = matchesMask;
            features2d_Features2d_drawMatches_10(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj);

            return;
#else
            return;
#endif
        }
예제 #10
0
        //
        // C++:  void cv::DescriptorMatcher::match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
        //

        //javadoc: DescriptorMatcher::match(queryDescriptors, matches, masks)
        public void match(Mat queryDescriptors, MatOfDMatch matches, List <Mat> masks)
        {
            ThrowIfDisposed();
            if (queryDescriptors != null)
            {
                queryDescriptors.ThrowIfDisposed();
            }
            if (matches != null)
            {
                matches.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat matches_mat = matches;
            Mat masks_mat   = Converters.vector_Mat_to_Mat(masks);
            features2d_DescriptorMatcher_match_12(nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, masks_mat.nativeObj);

            return;
#else
            return;
#endif
        }
예제 #11
0
        //javadoc: drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg)
        public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg)
        {
            if (img1 != null)
            {
                img1.ThrowIfDisposed();
            }
            if (keypoints1 != null)
            {
                keypoints1.ThrowIfDisposed();
            }
            if (img2 != null)
            {
                img2.ThrowIfDisposed();
            }
            if (keypoints2 != null)
            {
                keypoints2.ThrowIfDisposed();
            }
            if (matches1to2 != null)
            {
                matches1to2.ThrowIfDisposed();
            }
            if (outImg != null)
            {
                outImg.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat keypoints1_mat  = keypoints1;
            Mat keypoints2_mat  = keypoints2;
            Mat matches1to2_mat = matches1to2;
            features2d_Features2d_drawMatches_14(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);

            return;
#else
            return;
#endif
        }
예제 #12
0
        //
        // C++:  void cv::ShapeTransformer::estimateTransformation(Mat transformingShape, Mat targetShape, vector_DMatch matches)
        //

        //javadoc: ShapeTransformer::estimateTransformation(transformingShape, targetShape, matches)
        public void estimateTransformation(Mat transformingShape, Mat targetShape, MatOfDMatch matches)
        {
            ThrowIfDisposed();
            if (transformingShape != null)
            {
                transformingShape.ThrowIfDisposed();
            }
            if (targetShape != null)
            {
                targetShape.ThrowIfDisposed();
            }
            if (matches != null)
            {
                matches.ThrowIfDisposed();
            }
#if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat matches_mat = matches;
            shape_ShapeTransformer_estimateTransformation_10(nativeObj, transformingShape.nativeObj, targetShape.nativeObj, matches_mat.nativeObj);

            return;
#else
            return;
#endif
        }