示例#1
0
        /// <summary>
        /// Extracts the features.
        /// </summary>
        /// <returns><c>true</c>, if features was extracted, <c>false</c> otherwise.</returns>
        /// <param name="image">Image.</param>
        /// <param name="keypoints">Keypoints.</param>
        /// <param name="descriptors">Descriptors.</param>
        bool extractFeatures(Mat image, MatOfKeyPoint keypoints, Mat descriptors)
        {
            if (image.total() == 0)
            {
                return(false);
            }
            if (image.channels() != 1)
            {
                return(false);
            }

            m_detector.detect(image, keypoints);
            if (keypoints.total() == 0)
            {
                return(false);
            }

            m_extractor.compute(image, keypoints, descriptors);
            if (keypoints.total() == 0)
            {
                return(false);
            }

            //Debug.Log ("extractFeatures true");

            //Mat tmpImage = new Mat();
            //
            //Features2d.drawKeypoints(image, keypoints, tmpImage);
            //
            //DebugHelpers.showMat(tmpImage);

            return(true);
        }