/// <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); }
/// <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; }
/// <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); }
/// <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; }