Пример #1
0
        //
        // C++:  void 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 = vector<char>(), int flags = 0)
        //

        /**
         * <p>Draws the found matches of keypoints from two images.</p>
         *
         * <p>This function draws matches of keypoints from two images in the output image.
         * Match is a line connecting two keypoints (circles). The structure
         * <code>DrawMatchesFlags</code> is defined as follows: struct DrawMatchesFlags
         * <code></p>
         *
         * <p>// C++ code:</p>
         *
         *
         * <p>enum</p>
         *
         *
         * <p>DEFAULT = 0, // Output image matrix will be created (Mat.create),</p>
         *
         * <p>// i.e. existing memory of output image may be reused.</p>
         *
         * <p>// Two source images, matches, and single keypoints</p>
         *
         * <p>// will be drawn.</p>
         *
         * <p>// For each keypoint, only the center point will be</p>
         *
         * <p>// drawn (without a circle around the keypoint with the</p>
         *
         * <p>// keypoint size and orientation).</p>
         *
         * <p>DRAW_OVER_OUTIMG = 1, // Output image matrix will not be</p>
         *
         * <p>// created (using Mat.create). Matches will be drawn</p>
         *
         * <p>// on existing content of output image.</p>
         *
         * <p>NOT_DRAW_SINGLE_POINTS = 2, // Single keypoints will not be drawn.</p>
         *
         * <p>DRAW_RICH_KEYPOINTS = 4 // For each keypoint, the circle around</p>
         *
         * <p>// keypoint with keypoint size and orientation will</p>
         *
         * <p>// be drawn.</p>
         *
         * <p>};</p>
         *
         * <p>};</p>
         *
         * <p></code></p>
         *
         * @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 <code>keypoints1[i]</code> has a corresponding point in
         * <code>keypoints2[matches[i]]</code>.
         * @param outImg Output image. Its content depends on the <code>flags</code>
         * value defining what is drawn in the output image. See possible
         * <code>flags</code> bit values below.
         * @param matchColor Color of matches (lines and connected keypoints). If
         * <code>matchColor==Scalar.all(-1)</code>, the color is generated randomly.
         * @param singlePointColor Color of single keypoints (circles), which means that
         * keypoints do not have the matches. If <code>singlePointColor==Scalar.all(-1)</code>,
         * the color is generated randomly.
         * @param matchesMask Mask determining which matches are drawn. If the mask is
         * empty, all matches are drawn.
         * @param flags Flags setting drawing features. Possible <code>flags</code> bit
         * values are defined by <code>DrawMatchesFlags</code>.
         *
         * @see <a href="http://docs.opencv.org/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html#drawmatches">org.opencv.features2d.Features2d.drawMatches</a>
         */
        public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask, int flags)
        {
            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_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            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, flags);

            return;
                                                #else
            return;
                                                #endif
        }
Пример #2
0
        //
        // C++:  void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, vector_Point2f prevPts, vector_Point2f& nextPts, vector_uchar& status, vector_float& err, Size winSize = Size(21,21), int maxLevel = 3, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01), int flags = 0, double minEigThreshold = 1e-4)
        //

        //javadoc: calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, winSize, maxLevel, criteria, flags, minEigThreshold)
        public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags, double minEigThreshold)
        {
            if (prevImg != null)
            {
                prevImg.ThrowIfDisposed();
            }
            if (nextImg != null)
            {
                nextImg.ThrowIfDisposed();
            }
            if (prevPts != null)
            {
                prevPts.ThrowIfDisposed();
            }
            if (nextPts != null)
            {
                nextPts.ThrowIfDisposed();
            }
            if (status != null)
            {
                status.ThrowIfDisposed();
            }
            if (err != null)
            {
                err.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat prevPts_mat = prevPts;
            Mat nextPts_mat = nextPts;
            Mat status_mat  = status;
            Mat err_mat     = err;
            video_Video_calcOpticalFlowPyrLK_10(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel, criteria.type, criteria.maxCount, criteria.epsilon, flags, minEigThreshold);

            return;
#else
            return;
#endif
        }
Пример #3
0
        //javadoc: calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err)
        public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err)
        {
            if (prevImg != null)
            {
                prevImg.ThrowIfDisposed();
            }
            if (nextImg != null)
            {
                nextImg.ThrowIfDisposed();
            }
            if (prevPts != null)
            {
                prevPts.ThrowIfDisposed();
            }
            if (nextPts != null)
            {
                nextPts.ThrowIfDisposed();
            }
            if (status != null)
            {
                status.ThrowIfDisposed();
            }
            if (err != null)
            {
                err.ThrowIfDisposed();
            }
#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
            Mat prevPts_mat = prevPts;
            Mat nextPts_mat = nextPts;
            Mat status_mat  = status;
            Mat err_mat     = err;
            video_Video_calcOpticalFlowPyrLK_12(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj);

            return;
#else
            return;
#endif
        }
Пример #4
0
        //javadoc: calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, winSize, maxLevel)
        public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel)
        {
            if (prevImg != null)
            {
                prevImg.ThrowIfDisposed();
            }
            if (nextImg != null)
            {
                nextImg.ThrowIfDisposed();
            }
            if (prevPts != null)
            {
                prevPts.ThrowIfDisposed();
            }
            if (nextPts != null)
            {
                nextPts.ThrowIfDisposed();
            }
            if (status != null)
            {
                status.ThrowIfDisposed();
            }
            if (err != null)
            {
                err.ThrowIfDisposed();
            }

#if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5
            Mat prevPts_mat = prevPts;
            Mat nextPts_mat = nextPts;
            Mat status_mat  = status;
            Mat err_mat     = err;
            video_Video_calcOpticalFlowPyrLK_11(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel);

            return;
#else
            return;
#endif
        }