mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
using SixLabors.Primitives;
|
|
|
|
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
|
|
{
|
|
/// <summary>
|
|
/// Defines edge detection processing using the Roberts Cross operator filter.
|
|
/// See <see href="http://en.wikipedia.org/wiki/Roberts_cross"/>.
|
|
/// </summary>
|
|
public sealed class RobertsCrossProcessor : EdgeDetectorProcessor
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="RobertsCrossProcessor"/> class.
|
|
/// </summary>
|
|
/// <param name="grayscale">Whether to convert the image to grayscale before performing edge detection.</param>
|
|
public RobertsCrossProcessor(bool grayscale)
|
|
: base(grayscale)
|
|
{
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>(Configuration configuration, Image<TPixel> source, Rectangle sourceRectangle)
|
|
=> new EdgeDetector2DProcessor<TPixel>(
|
|
configuration,
|
|
RobertsCrossKernels.RobertsCrossX,
|
|
RobertsCrossKernels.RobertsCrossY,
|
|
this.Grayscale,
|
|
source,
|
|
sourceRectangle);
|
|
}
|
|
}
|
|
|