public List <ScaleInvariantFeatureTranformKeypoint> ProcessImage(UnmanagedImage image)
        {
            // check image format
            if (
                (image.PixelFormat != PixelFormat.Format8bppIndexed) &&
                (image.PixelFormat != PixelFormat.Format24bppRgb) &&
                (image.PixelFormat != PixelFormat.Format32bppRgb) &&
                (image.PixelFormat != PixelFormat.Format32bppArgb)
                )
            {
                throw new UnsupportedImageFormatException("Unsupported pixel format of the source image.");
            }

            // make sure we have grayscale image
            if (image.PixelFormat == PixelFormat.Format8bppIndexed)
            {
                _grayImage = image;
            }
            else
            {
                // create temporary grayscale image
                _grayImage = Grayscale.CommonAlgorithms.BT709.Apply(image);
            }


            // 1. Extract corners points from the image.
            List <IntPoint> corners = Detector.ProcessImage(_grayImage);

            List <ScaleInvariantFeatureTranformKeypoint> features = new List <ScaleInvariantFeatureTranformKeypoint>();

            for (int i = 0; i < corners.Count; i++)
            {
                features.Add(new ScaleInvariantFeatureTranformKeypoint(corners[i].X, corners[i].Y));
            }


            // 2. Compute the integral for the given image
            _integral = IntegralImage.FromBitmap(_grayImage);


            // 3. Compute feature descriptors if required
            _descriptor = null;
            if (_featureType != ScaleInvariantFeatureTranformKeypointDescriptorType.None)
            {
                _descriptor = GetDescriptor();
                _descriptor.Compute(features);
            }

            return(features);
        }
        public ScaleInvariantFeatureTranformKeypointDescriptor GetDescriptor()
        {
            if (_descriptor == null || _pattern == null)
            {
                if (_pattern == null)
                {
                    _pattern = new ScaleInvariantFeatureTranformKeypointPattern(_octaves, _scale);
                }

                _descriptor          = new ScaleInvariantFeatureTranformKeypointDescriptor(_grayImage, _integral, _pattern);
                _descriptor.Extended = _featureType == ScaleInvariantFeatureTranformKeypointDescriptorType.Extended;
            }

            return(_descriptor);
        }