mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: 1a1c53bdeb6a5a6040ea2da8202693689a8004a4 Former-commit-id: af63533f9f04e814c10bb41a456217fa569846f5 Former-commit-id: cfa93ef57fea2c3c24da41c9da4b7153c91c7d90af/merge-core
5 changed files with 94 additions and 1 deletions
@ -0,0 +1,82 @@ |
|||
// <copyright file="RobinsonProcessor.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageProcessorCore.Processors |
|||
{ |
|||
/// <summary>
|
|||
/// The Kirsch operator filter.
|
|||
/// <see href="http://www.tutorialspoint.com/dip/Robinson_Compass_Mask.htm"/>
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|||
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
|
|||
public class RobinsonProcessor<TColor, TPacked> : EdgeDetectorCompassFilter<TColor, TPacked> |
|||
where TColor : IPackedVector<TPacked> |
|||
where TPacked : struct |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override float[,] North => new float[,] |
|||
{ |
|||
{ 1, 2, 1 }, |
|||
{ 0, 0, 0 }, |
|||
{ -1, -2, -1 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] NorthWest => new float[,] |
|||
{ |
|||
{ 2, 1, 0 }, |
|||
{ 1, 0, -1 }, |
|||
{ 0, -1, -2 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] West => new float[,] |
|||
{ |
|||
{ 1, 0, -1 }, |
|||
{ 2, 0, -2 }, |
|||
{ 1, 0, -1 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] SouthWest => new float[,] |
|||
{ |
|||
{ 0, -1, -2 }, |
|||
{ 1, 0, -1 }, |
|||
{ 2, 1, 0 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] South => new float[,] |
|||
{ |
|||
{ -1, -2, -1 }, |
|||
{ 0, 0, 0 }, |
|||
{ 1, 2, 1 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] SouthEast => new float[,] |
|||
{ |
|||
{ -2, -1, 0 }, |
|||
{ -1, 0, 1 }, |
|||
{ 0, 1, 2 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] East => new float[,] |
|||
{ |
|||
{ -1, 0, 1 }, |
|||
{ -2, 0, 2 }, |
|||
{ -1, 0, 1 } |
|||
}; |
|||
|
|||
/// <inheritdoc/>
|
|||
public override float[,] NorthEast => new float[,] |
|||
{ |
|||
{ 0, 1, 2 }, |
|||
{ -1, 0, 1 }, |
|||
{ -2, -1, 0 } |
|||
}; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue