Fast Retina Keypoint (FREAK) descriptor.

Based on original implementation by A. Alahi, R. Ortiz, and P. Vandergheynst, distributed under a BSD style license.

In order to extract feature points from an image using FREAK, please take a look on the FastRetinaKeypointDetector documentation page.

References: A. Alahi, R. Ortiz, and P. Vandergheynst. FREAK: Fast Retina Keypoint. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2012 Open Source Award Winner.

Inheritance: ICloneable
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public object Clone()
        {
            var clone = new FastRetinaKeypointDescriptor();

            clone.Extended            = Extended;
            clone.Image               = Image.Clone();
            clone.Integral            = (IntegralImage)Integral.Clone();
            clone.IsOrientationNormal = IsOrientationNormal;
            clone.IsScaleNormal       = IsScaleNormal;
            clone.pattern             = (FastRetinaKeypointPattern)pattern.Clone();
            return(clone);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Gets the <see cref="FastRetinaKeypointDescriptor">
        ///   feature descriptor</see> for the last processed image.
        /// </summary>
        /// 
        public FastRetinaKeypointDescriptor GetDescriptor()
        {
            if (descriptor == null || pattern == null)
            {
                if (pattern == null)
                    pattern = new FastRetinaKeypointPattern(octaves, scale);

                descriptor = new FastRetinaKeypointDescriptor(grayImage, integral, pattern);
                descriptor.Extended = featureType == FastRetinaKeypointDescriptorType.Extended;
            }

            return descriptor;
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
 /// <summary>
 ///   Creates a new object that is a copy of the current instance.
 /// </summary>
 /// 
 /// <returns>
 ///   A new object that is a copy of this instance.
 /// </returns>
 /// 
 public object Clone()
 {
     var clone = new FastRetinaKeypointDescriptor();
     clone.Extended = Extended;
     clone.Image = Image.Clone();
     clone.Integral = (IntegralImage)Integral.Clone();
     clone.IsOrientationNormal = IsOrientationNormal;
     clone.IsScaleNormal = IsScaleNormal;
     clone.pattern = (FastRetinaKeypointPattern)pattern.Clone();
     return clone;
 }