示例#1
0
        /// <summary>
        /// Applies Canny filter on specified image. (uses AForge implementation)
        /// </summary>
        /// <param name="im">image</param>
        /// <param name="lowThreshold">Low threshold value used for hysteresis</param>
        /// <param name="highThreshold">High threshold value used for hysteresis</param>
        /// <param name="sigma">Gaussian sigma</param>
        /// <param name="gaussianSize">Gaussian filter size</param>
        /// <returns>Processed image with Canny filter</returns>
        public static Gray<byte>[,] Canny(this Gray<byte>[,] im, byte lowThreshold = 20, byte highThreshold = 100, double sigma = 1.4, int gaussianSize = 5)
        {
            CannyEdgeDetector canny = new CannyEdgeDetector(lowThreshold, highThreshold, sigma);
            canny.GaussianSize = gaussianSize;

            return im.ApplyFilter(canny);
        }
示例#2
0
 public static IList<MessageModel> InfoList(this IList<MessageModel> messages)
 {
     var result = messages.ApplyFilter(m => m.MessageType == MessageTypes.Info);
     return result;
 }
 /// <summary>
 /// Applies White Patch filter for color normalization (Accord.NET function)
 /// </summary>
 /// <param name="img">image.</param>
 /// <param name="inPlace">Apply in place or not. If it is set to true return value can be omitted.</param>
 /// <returns>Processed image.</returns>
 public static Bgra<byte>[,] WhitePatch(this Bgra<byte>[,] img, bool inPlace = true)
 {
     WhitePatch wp = new WhitePatch();
     return img.ApplyFilter(wp, inPlace);
 }
示例#4
0
 /// <summary>
 /// Kuwahara filter.
 /// <para>Accord.NET internal call. See: <see cref="Accord.Imaging.Filters.Kuwahara"/> for details.</para>
 /// </summary>
 /// <param name="img">Image.</param>
 /// <param name="size">the size of the kernel used in the Kuwahara filter. This should be odd and greater than or equal to five</param>
 /// <param name="blockSize">the size of each of the four inner blocks used in the Kuwahara filter. This is always half the <paramref name="size"/> minus one.</param>
 /// <param name="inPlace">Apply in place or not. If it is set to true return value can be omitted.</param>
 /// <returns>Processed image.</returns>
 public static Gray<byte>[,] Kuwahara(this Gray<byte>[,] img, int size = 5, int blockSize = 2, bool inPlace = false)
 {
     Kuwahara k = new Kuwahara();
     return img.ApplyFilter(k, inPlace);
 }
 /// <summary>
 /// <para>(Accord .NET internal call)</para>
 /// In image processing, a Gabor filter, named after Dennis Gabor, is a linear 
 /// filter used for edge detection. Frequency and orientation representations 
 /// of Gabor filters are similar to those of the human visual system, and they
 /// have been found to be particularly appropriate for texture representation 
 /// and discrimination. In the spatial domain, a 2D Gabor filter is a Gaussian
 /// kernel function modulated by a sinusoidal plane wave. The Gabor filters are
 /// self-similar: all filters can be generated from one mother wavelet by dilation
 /// and rotation.
 /// </summary>
 /// <param name="img">Image.</param>
 /// <param name="gaborFilter">Gabor filter instance. 
 /// <para>To avoid calculating Gabor every time use this function overload that receives instance.</para>
 /// </param>
 /// <returns>Filtered image.</returns>
 internal static Gray<byte>[,] GaborFilter(this Gray<byte>[,] img, GaborFilter gaborFilter)
 {
     return img.ApplyFilter(gaborFilter);
 }
 /// <summary>
 /// Gray World filter for color normalization. 
 /// <para>Accord.NET internal call.</para>
 /// </summary>
 /// <param name="img">Image.</param>
 /// <param name="inPlace">Apply in place or not. If it is set to true return value can be omitted.</param>
 /// <returns>Processed image.</returns>
 public static Bgra<byte>[,] GrayWorld(this Bgra<byte>[,] img, bool inPlace = true)
 {
     GrayWorld gw = new GrayWorld();
     return img.ApplyFilter(gw, inPlace);
 }
 /// <summary>
 /// Applies wavelet transform filter (Accord.NET).
 /// </summary>
 /// <param name="img">Image.</param>
 /// <param name="wavelet">A wavelet function.</param>
 /// <param name="backward">True to perform backward transform, false otherwise.</param>
 /// <returns>Transformed image.</returns>
 public static Gray<byte>[,] WaveletTransform(this Gray<byte>[,] img, IWavelet wavelet, bool backward = false)
 {
     WaveletTransform wt = new WaveletTransform(wavelet, backward);
     return img.ApplyFilter((BaseFilter)wt);
 }
 /// <summary>
 /// Kuwahara filter.
 /// <para>Accord.NET internal call. See: <see cref="Accord.Imaging.Filters.Kuwahara"/> for details.</para>
 /// </summary>
 /// <param name="img">Image.</param>
 /// <param name="size">the size of the kernel used in the Kuwahara filter. This should be odd and greater than or equal to five</param>
 /// <param name="blockSize">the size of each of the four inner blocks used in the Kuwahara filter. This is always half the <paramref name="size"/> minus one.</param>
 /// <param name="inPlace">Apply in place or not. If it is set to true return value can be omitted.</param>
 /// <returns>Processed image.</returns>
 public static Image<Gray, byte> Kuwahara(this Image<Gray, byte> img, int size = 5, int blockSize = 2, bool inPlace = false)
 {
     Kuwahara k = new Kuwahara();
     return img.ApplyFilter(k, inPlace);
 }