OpenCvSharp.NativeMethods.features2d_BOWImgDescriptorExtractor_compute11 C# (CSharp) Method

features2d_BOWImgDescriptorExtractor_compute11() private method

private features2d_BOWImgDescriptorExtractor_compute11 ( IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr imgDescriptor, IntPtr pointIdxsOfClusters, IntPtr descriptors ) : void
obj IntPtr
image IntPtr
keypoints IntPtr
imgDescriptor IntPtr
pointIdxsOfClusters IntPtr
descriptors IntPtr
return void
        public static extern void features2d_BOWImgDescriptorExtractor_compute11(
            IntPtr obj, IntPtr image, IntPtr keypoints, IntPtr imgDescriptor,
            IntPtr pointIdxsOfClusters, IntPtr descriptors);
        [DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl)]

Usage Example

コード例 #1
0
        /// <summary>
        /// Computes an image descriptor using the set visual vocabulary.
        /// </summary>
        /// <param name="image">Image, for which the descriptor is computed.</param>
        /// <param name="keypoints">Keypoints detected in the input image.</param>
        /// <param name="imgDescriptor">Computed output image descriptor.</param>
        /// <param name="pointIdxsOfClusters">pointIdxsOfClusters Indices of keypoints that belong to the cluster.
        /// This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster(word of vocabulary) returned if it is non-zero.</param>
        /// <param name="descriptors">Descriptors of the image keypoints that are returned if they are non-zero.</param>
        public void Compute(InputArray image, ref KeyPoint[] keypoints, OutputArray imgDescriptor,
                            out int[][] pointIdxsOfClusters, Mat descriptors = null)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }
            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }
            if (imgDescriptor == null)
            {
                throw new ArgumentNullException(nameof(imgDescriptor));
            }

            using (var keypointsVec = new VectorOfKeyPoint(keypoints))
                using (var pointIdxsOfClustersVec = new VectorOfVectorInt())
                {
                    NativeMethods.features2d_BOWImgDescriptorExtractor_compute11(ptr, image.CvPtr, keypointsVec.CvPtr,
                                                                                 imgDescriptor.CvPtr, pointIdxsOfClustersVec.CvPtr, Cv2.ToPtr(descriptors));
                    keypoints           = keypointsVec.ToArray();
                    pointIdxsOfClusters = pointIdxsOfClustersVec.ToArray();
                }
            GC.KeepAlive(image);
            GC.KeepAlive(imgDescriptor);
            GC.KeepAlive(descriptors);
        }
NativeMethods