mirror of https://github.com/SixLabors/ImageSharp
7 changed files with 110 additions and 72 deletions
@ -1,68 +0,0 @@ |
|||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||
// <copyright file="CostellaEdgeFilter.cs" company="James South">
|
|
||||
// Copyright (c) James South.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
// </copyright>
|
|
||||
// <summary>
|
|
||||
// The Costella operator filter.
|
|
||||
// <see href="http://johncostella.com/edgedetect/" />
|
|
||||
// </summary>
|
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||
|
|
||||
namespace ImageProcessor.Imaging.EdgeDetection |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// The Costella operator filter.
|
|
||||
/// <see href="http://johncostella.com/edgedetect/"/>
|
|
||||
/// </summary>
|
|
||||
public class CostellaEdgeFilter : IEdgeFilter |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Gets the horizontal gradient operator.
|
|
||||
/// </summary>
|
|
||||
public double[,] HorizontalGradientOperator |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
//return new double[,]
|
|
||||
//{ { -1, -1, -1, -1, -1, },
|
|
||||
// { -1, -1, -1, -1, -1, },
|
|
||||
// { -1, -1, 24, -1, -1, },
|
|
||||
// { -1, -1, -1, -1, -1, },
|
|
||||
// { -1, -1, -1, -1, -1 }, };
|
|
||||
return new double[,] |
|
||||
{ |
|
||||
{ -1, -3, 0, 3, 1 }, |
|
||||
{ -1, -3, 0, 3, 1 }, |
|
||||
{ -1, -3, 0, 3, 1 }, |
|
||||
{ -1, -3, 0, 3, 1 }, |
|
||||
{ -1, -3, 0, 3, 1 } |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Gets the vertical gradient operator.
|
|
||||
/// </summary>
|
|
||||
public double[,] VerticalGradientOperator |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
//return new double[,]
|
|
||||
//{ { -1, -1, -1, -1, -1, },
|
|
||||
// { -1, -1, -1, -1, -1, },
|
|
||||
// { -1, -1, 24, -1, -1, },
|
|
||||
// { -1, -1, -1, -1, -1, },
|
|
||||
// { -1, -1, -1, -1, -1 }, };
|
|
||||
return new double[,] |
|
||||
{ |
|
||||
{ 1, 1, 1, 1, 1 }, |
|
||||
{ 3, 3, 3, 3, 3 }, |
|
||||
{ 0, 0, 0, 0, 0 }, |
|
||||
{ -3, -3, -3, -3, -3 }, |
|
||||
{ -1, -1, -1, -1, -1 } |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,52 @@ |
|||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
// <copyright file="KayyaliEdgeFilter.cs" company="James South">
|
||||
|
// Copyright (c) James South.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
// </copyright>
|
||||
|
// <summary>
|
||||
|
// The Kayyali operator filter.
|
||||
|
// <see href="http://edgedetection.webs.com/" />
|
||||
|
// </summary>
|
||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace ImageProcessor.Imaging.EdgeDetection |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The Kayyali operator filter.
|
||||
|
/// <see href="http://edgedetection.webs.com/"/>
|
||||
|
/// </summary>
|
||||
|
public class KayyaliEdgeFilter : IEdgeFilter |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets the horizontal gradient operator.
|
||||
|
/// </summary>
|
||||
|
public double[,] HorizontalGradientOperator |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return new double[,] |
||||
|
{ |
||||
|
{ 6, 0, -6 }, |
||||
|
{ 0, 0, 0 }, |
||||
|
{ -6, 0, 6 } |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the vertical gradient operator.
|
||||
|
/// </summary>
|
||||
|
public double[,] VerticalGradientOperator |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return new double[,] |
||||
|
{ |
||||
|
{ -6, 0, 6 }, |
||||
|
{ 0, 0, 0 }, |
||||
|
{ 6, 0, -6 } |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
// <copyright file="KirschEdgeFilter.cs" company="James South">
|
||||
|
// Copyright (c) James South.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
// </copyright>
|
||||
|
// <summary>
|
||||
|
// The Kirsch operator filter.
|
||||
|
// <see href="http://en.wikipedia.org/wiki/Kirsch_operator" />
|
||||
|
// </summary>
|
||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace ImageProcessor.Imaging.EdgeDetection |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The Kirsch operator filter.
|
||||
|
/// <see href="http://en.wikipedia.org/wiki/Kirsch_operator"/>
|
||||
|
/// </summary>
|
||||
|
public class KirschEdgeFilter : IEdgeFilter |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets the horizontal gradient operator.
|
||||
|
/// </summary>
|
||||
|
public double[,] HorizontalGradientOperator |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return new double[,] |
||||
|
{ |
||||
|
{ 5, 5, 5 }, |
||||
|
{ -3, 0, -3 }, |
||||
|
{ -3, -3, -3 } |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the vertical gradient operator.
|
||||
|
/// </summary>
|
||||
|
public double[,] VerticalGradientOperator |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return new double[,] |
||||
|
{ |
||||
|
{ 5, -3, -3 }, |
||||
|
{ 5, 0, -3 }, |
||||
|
{ 5, -3, -3 } |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue