Пример #1
0
        /// <summary>
        /// Compute the BRISK features and descriptors on an image
        /// </summary>
        /// <param name="image"></param>
        /// <param name="mask"></param>
        /// <param name="keyPoints"></param>
        /// <param name="descriptors"></param>
        /// <param name="useProvidedKeypoints"></param>
        public void Run(InputArray image, InputArray mask, out KeyPoint[] keyPoints,
                        out float[] descriptors, bool useProvidedKeypoints = false)
        {
            MatOfFloat descriptorsMat = new MatOfFloat();

            Run(image, mask, out keyPoints, descriptorsMat, useProvidedKeypoints);
            descriptors = descriptorsMat.ToArray();
        }
Пример #2
0
        /// <summary>
        /// keypoint を検出し,その SIFT ディスクリプタを計算します.
        /// </summary>
        /// <param name="img">Input 8-bit grayscale image</param>
        /// <param name="mask">Optional input mask that marks the regions where we should detect features.</param>
        /// <param name="keypoints">The input/output vector of keypoints</param>
        /// <param name="descriptors">The output matrix of descriptors. </param>
        /// <param name="useProvidedKeypoints">Boolean flag. If it is true, the keypoint detector is not run.
        /// Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors.</param>
#else
        /// <summary>
        /// detects keypoints and computes the SIFT descriptors for them.
        /// </summary>
        /// <param name="img">Input 8-bit grayscale image</param>
        /// <param name="mask">Optional input mask that marks the regions where we should detect features.</param>
        /// <param name="keypoints">The input/output vector of keypoints</param>
        /// <param name="descriptors">The output matrix of descriptors. </param>
        /// <param name="useProvidedKeypoints">Boolean flag. If it is true, the keypoint detector is not run.
        /// Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors.</param>
#endif
        public void Run(InputArray img, InputArray mask, out KeyPoint[] keypoints, out float[] descriptors,
                        bool useProvidedKeypoints = false)
        {
            // SIFTは std::vector<float> でdescriptorを受け取れないっぽいので、自前実装
            MatOfFloat descriptorsMat = new MatOfFloat();

            Run(img, mask, out keypoints, descriptorsMat, useProvidedKeypoints);

            descriptors = descriptorsMat.ToArray();
        }