@ -8,58 +8,58 @@ namespace ImageProcessorCore
using Processors ;
/// <summary>
/// Extension methods for the <see cref="Image{T,TP}"/> type.
/// Extension methods for the <see cref="Image{TColor , TPacked }"/> type.
/// </summary>
public static partial class ImageExtensions
{
/// <summary>
/// Detects any edges within the image. Uses the <see cref="SobelProcessor{T,TP}"/> filter
/// Detects any edges within the image. Uses the <see cref="SobelProcessor{TColor , TPacked }"/> filter
/// operating in Grayscale mode.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <typeparam name="TColor ">The pixel format.</typeparam>
/// <typeparam name="TPacked ">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
/// <returns>The <see cref="Image{T,TP}"/>.</returns>
public static Image < T , TP > DetectEdges < T , TP > ( this Image < T , TP > source , ProgressEventHandler progressHandler = null )
where T : IPackedVector < TP >
where TP : struct
/// <returns>The <see cref="Image{TColor , TPacked }"/>.</returns>
public static Image < TColor , TPacked > DetectEdges < TColor , TPacked > ( this Image < TColor , TPacked > source , ProgressEventHandler progressHandler = null )
where TColor : IPackedVector < TPacked >
where TPacked : struct
{
return DetectEdges ( source , source . Bounds , new SobelProcessor < T , TP > { Grayscale = true } , progressHandler ) ;
return DetectEdges ( source , source . Bounds , new SobelProcessor < TColor , TPacked > { Grayscale = true } , progressHandler ) ;
}
/// <summary>
/// Detects any edges within the image. Uses the <see cref="SobelProcessor{T,TP}"/> filter
/// Detects any edges within the image. Uses the <see cref="SobelProcessor{TColor , TPacked }"/> filter
/// operating in Grayscale mode.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <typeparam name="TColor ">The pixel format.</typeparam>
/// <typeparam name="TPacked ">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
/// <returns>The <see cref="Image{T,TP}"/>.</returns>
public static Image < T , TP > DetectEdges < T , TP > ( this Image < T , TP > source , Rectangle rectangle , ProgressEventHandler progressHandler = null )
where T : IPackedVector < TP >
where TP : struct
/// <returns>The <see cref="Image{TColor , TPacked }"/>.</returns>
public static Image < TColor , TPacked > DetectEdges < TColor , TPacked > ( this Image < TColor , TPacked > source , Rectangle rectangle , ProgressEventHandler progressHandler = null )
where TColor : IPackedVector < TPacked >
where TPacked : struct
{
return DetectEdges ( source , rectangle , new SobelProcessor < T , TP > { Grayscale = true } , progressHandler ) ;
return DetectEdges ( source , rectangle , new SobelProcessor < TColor , TPacked > { Grayscale = true } , progressHandler ) ;
}
/// <summary>
/// Detects any edges within the image.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <typeparam name="TColor ">The pixel format.</typeparam>
/// <typeparam name="TPacked ">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="filter">The filter for detecting edges.</param>
/// <param name="grayscale">Whether to convert the image to Grayscale first. Defaults to true.</param>
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
/// <returns>The <see cref="Image{T,TP}"/>.</returns>
public static Image < T , TP > DetectEdges < T , TP > ( this Image < T , TP > source , EdgeDetection filter , bool grayscale = true , ProgressEventHandler progressHandler = null )
where T : IPackedVector < TP >
where TP : struct
/// <returns>The <see cref="Image{TColor , TPacked }"/>.</returns>
public static Image < TColor , TPacked > DetectEdges < TColor , TPacked > ( this Image < TColor , TPacked > source , EdgeDetection filter , bool grayscale = true , ProgressEventHandler progressHandler = null )
where TColor : IPackedVector < TPacked >
where TPacked : struct
{
return DetectEdges ( source , filter , source . Bounds , grayscale , progressHandler ) ;
}
@ -67,8 +67,8 @@ namespace ImageProcessorCore
/// <summary>
/// Detects any edges within the image.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <typeparam name="TColor ">The pixel format.</typeparam>
/// <typeparam name="TPacked ">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="filter">The filter for detecting edges.</param>
/// <param name="rectangle">
@ -76,49 +76,49 @@ namespace ImageProcessorCore
/// </param>
/// <param name="grayscale">Whether to convert the image to Grayscale first. Defaults to true.</param>
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
/// <returns>The <see cref="Image{T,TP}"/>.</returns>
public static Image < T , TP > DetectEdges < T , TP > ( this Image < T , TP > source , EdgeDetection filter , Rectangle rectangle , bool grayscale = true , ProgressEventHandler progressHandler = null )
where T : IPackedVector < TP >
where TP : struct
/// <returns>The <see cref="Image{TColor , TPacked }"/>.</returns>
public static Image < TColor , TPacked > DetectEdges < TColor , TPacked > ( this Image < TColor , TPacked > source , EdgeDetection filter , Rectangle rectangle , bool grayscale = true , ProgressEventHandler progressHandler = null )
where TColor : IPackedVector < TPacked >
where TPacked : struct
{
IEdgeDetectorFilter < T , TP > processor ;
IEdgeDetectorFilter < TColor , TPacked > processor ;
switch ( filter )
{
case EdgeDetection . Kayyali :
processor = new KayyaliProcessor < T , TP > { Grayscale = grayscale } ;
processor = new KayyaliProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . Kirsch :
processor = new KirschProcessor < T , TP > { Grayscale = grayscale } ;
processor = new KirschProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . Lapacian3X3 :
processor = new Laplacian3X3Processor < T , TP > { Grayscale = grayscale } ;
processor = new Laplacian3X3Processor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . Lapacian5X5 :
processor = new Laplacian5X5Processor < T , TP > { Grayscale = grayscale } ;
processor = new Laplacian5X5Processor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . LaplacianOfGaussian :
processor = new LaplacianOfGaussianProcessor < T , TP > { Grayscale = grayscale } ;
processor = new LaplacianOfGaussianProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . Prewitt :
processor = new PrewittProcessor < T , TP > { Grayscale = grayscale } ;
processor = new PrewittProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . RobertsCross :
processor = new RobertsCrossProcessor < T , TP > { Grayscale = grayscale } ;
processor = new RobertsCrossProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
case EdgeDetection . Scharr :
processor = new ScharrProcessor < T , TP > { Grayscale = grayscale } ;
processor = new ScharrProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
default :
processor = new ScharrProcessor < T , TP > { Grayscale = grayscale } ;
processor = new ScharrProcessor < TColor , TPacked > { Grayscale = grayscale } ;
break ;
}
@ -128,15 +128,15 @@ namespace ImageProcessorCore
/// <summary>
/// Detects any edges within the image.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <typeparam name="TColor ">The pixel format.</typeparam>
/// <typeparam name="TPacked ">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="filter">The filter for detecting edges.</param>
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
/// <returns>The <see cref="Image{T,TP}"/>.</returns>
public static Image < T , TP > DetectEdges < T , TP > ( this Image < T , TP > source , IEdgeDetectorFilter < T , TP > filter , ProgressEventHandler progressHandler = null )
where T : IPackedVector < TP >
where TP : struct
/// <returns>The <see cref="Image{TColor , TPacked }"/>.</returns>
public static Image < TColor , TPacked > DetectEdges < TColor , TPacked > ( this Image < TColor , TPacked > source , IEdgeDetectorFilter < TColor , TPacked > filter , ProgressEventHandler progressHandler = null )
where TColor : IPackedVector < TPacked >
where TPacked : struct
{
return DetectEdges ( source , source . Bounds , filter , progressHandler ) ;
}
@ -144,18 +144,18 @@ namespace ImageProcessorCore
/// <summary>
/// Detects any edges within the image.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <typeparam name="TColor ">The pixel format.</typeparam>
/// <typeparam name="TPacked ">The packed format. <example>uint, long, float.</example></typeparam>
/// <param name="source">The image this method extends.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
/// <param name="filter">The filter for detecting edges.</param>
/// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
/// <returns>The <see cref="Image{T,TP}"/>.</returns>
public static Image < T , TP > DetectEdges < T , TP > ( this Image < T , TP > source , Rectangle rectangle , IEdgeDetectorFilter < T , TP > filter , ProgressEventHandler progressHandler = null )
where T : IPackedVector < TP >
where TP : struct
/// <returns>The <see cref="Image{TColor , TPacked }"/>.</returns>
public static Image < TColor , TPacked > DetectEdges < TColor , TPacked > ( this Image < TColor , TPacked > source , Rectangle rectangle , IEdgeDetectorFilter < TColor , TPacked > filter , ProgressEventHandler progressHandler = null )
where TColor : IPackedVector < TPacked >
where TPacked : struct
{
filter . OnProgress + = progressHandler ;