OpenCvSharp.BOWImgDescriptorExtractor.Compute2 C# (CSharp) Method

Compute2() public method

Computes an image descriptor using the set visual vocabulary.
public Compute2 ( OpenCvSharp.Mat image, KeyPoint &keypoints, OpenCvSharp.Mat imgDescriptor ) : void
image OpenCvSharp.Mat Image, for which the descriptor is computed.
keypoints KeyPoint Keypoints detected in the input image.
imgDescriptor OpenCvSharp.Mat Computed output image descriptor.
return void
        public void Compute2(Mat image, out KeyPoint[] keypoints, Mat imgDescriptor)
        {
            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())
            {
                NativeMethods.features2d_BOWImgDescriptorExtractor_compute2(
                    ptr, image.CvPtr, keypointsVec.CvPtr, imgDescriptor.CvPtr);
                keypoints = keypointsVec.ToArray();
            }
            GC.KeepAlive(image);
            GC.KeepAlive(imgDescriptor);
        }