Compute() public method

Describes the specified point (i.e. computes and sets the orientation and descriptor vector fields of the FastRetinaKeypoint.
public Compute ( IList points ) : void
points IList The point to be described.
return void
コード例 #1
0
        /// <summary>
        ///   Process image looking for interest points.
        /// </summary>
        ///
        /// <param name="image">Source image data to process.</param>
        ///
        /// <returns>Returns list of found interest points.</returns>
        ///
        public List <FastRetinaKeypoint> 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);

            var features = new List <FastRetinaKeypoint>();

            for (int i = 0; i < corners.Count; i++)
            {
                features.Add(new FastRetinaKeypoint(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 != FastRetinaKeypointDescriptorType.None)
            {
                descriptor = GetDescriptor();
                descriptor.Compute(features);
            }

            return(features);
        }
コード例 #2
0
        /// <summary>
        ///   This method should be implemented by inheriting classes to implement the
        ///   actual feature extraction, transforming the input image into a list of features.
        /// </summary>
        ///
        protected override IEnumerable <FastRetinaKeypoint> InnerTransform(UnmanagedImage 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);

            var features = new List <FastRetinaKeypoint>();

            for (int i = 0; i < corners.Count; i++)
            {
                features.Add(new FastRetinaKeypoint(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 != FastRetinaKeypointDescriptorType.None)
            {
                descriptor = GetDescriptor();
                descriptor.Compute(features);
            }

            return(features);
        }