Browse Source

refactor BoxBlur and GaussianBlur

pull/904/head
Anton Firszov 7 years ago
parent
commit
ff48c62e71
  1. 20
      src/ImageSharp/Processing/BoxBlurExtensions.cs
  2. 20
      src/ImageSharp/Processing/GaussianBlurExtensions.cs
  3. 53
      src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs
  4. 64
      src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs
  5. 82
      src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs
  6. 79
      src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor{TPixel}.cs
  7. 6
      tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs
  8. 6
      tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs

20
src/ImageSharp/Processing/BoxBlurExtensions.cs

@ -8,43 +8,37 @@ using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing namespace SixLabors.ImageSharp.Processing
{ {
/// <summary> /// <summary>
/// Adds box blurring extensions to the <see cref="Image{TPixel}"/> type. /// Adds box blurring extensions to the <see cref="Image"/> type.
/// </summary> /// </summary>
public static class BoxBlurExtensions public static class BoxBlurExtensions
{ {
/// <summary> /// <summary>
/// Applies a box blur to the image. /// Applies a box blur to the image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BoxBlur<TPixel>(this IImageProcessingContext<TPixel> source) public static IImageProcessingContext BoxBlur(this IImageProcessingContext source)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new BoxBlurProcessor());
=> source.ApplyProcessor(new BoxBlurProcessor<TPixel>());
/// <summary> /// <summary>
/// Applies a box blur to the image. /// Applies a box blur to the image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param> /// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BoxBlur<TPixel>(this IImageProcessingContext<TPixel> source, int radius) public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new BoxBlurProcessor(radius));
=> source.ApplyProcessor(new BoxBlurProcessor<TPixel>(radius));
/// <summary> /// <summary>
/// Applies a box blur to the image. /// Applies a box blur to the image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="radius">The 'radius' value representing the size of the area to sample.</param> /// <param name="radius">The 'radius' value representing the size of the area to sample.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> BoxBlur<TPixel>(this IImageProcessingContext<TPixel> source, int radius, Rectangle rectangle) public static IImageProcessingContext BoxBlur(this IImageProcessingContext source, int radius, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle);
=> source.ApplyProcessor(new BoxBlurProcessor<TPixel>(radius), rectangle);
} }
} }

20
src/ImageSharp/Processing/GaussianBlurExtensions.cs

@ -8,43 +8,37 @@ using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing namespace SixLabors.ImageSharp.Processing
{ {
/// <summary> /// <summary>
/// Adds Gaussian blurring extensions to the <see cref="Image{TPixel}"/> type. /// Adds Gaussian blurring extensions to the <see cref="Image"/> type.
/// </summary> /// </summary>
public static class GaussianBlurExtensions public static class GaussianBlurExtensions
{ {
/// <summary> /// <summary>
/// Applies a Gaussian blur to the image. /// Applies a Gaussian blur to the image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> GaussianBlur<TPixel>(this IImageProcessingContext<TPixel> source) public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new GaussianBlurProcessor());
=> source.ApplyProcessor(new GaussianBlurProcessor<TPixel>());
/// <summary> /// <summary>
/// Applies a Gaussian blur to the image. /// Applies a Gaussian blur to the image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param> /// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> GaussianBlur<TPixel>(this IImageProcessingContext<TPixel> source, float sigma) public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new GaussianBlurProcessor(sigma));
=> source.ApplyProcessor(new GaussianBlurProcessor<TPixel>(sigma));
/// <summary> /// <summary>
/// Applies a Gaussian blur to the image. /// Applies a Gaussian blur to the image.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="source">The image this method extends.</param> /// <param name="source">The image this method extends.</param>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param> /// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
/// <param name="rectangle"> /// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter. /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param> /// </param>
/// <returns>The <see cref="Image{TPixel}"/>.</returns> /// <returns>The <see cref="Image{TPixel}"/>.</returns>
public static IImageProcessingContext<TPixel> GaussianBlur<TPixel>(this IImageProcessingContext<TPixel> source, float sigma, Rectangle rectangle) public static IImageProcessingContext GaussianBlur(this IImageProcessingContext source, float sigma, Rectangle rectangle)
where TPixel : struct, IPixel<TPixel> => source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle);
=> source.ApplyProcessor(new GaussianBlurProcessor<TPixel>(sigma), rectangle);
} }
} }

53
src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs

@ -3,67 +3,48 @@
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{ {
/// <summary> /// <summary>
/// Applies box blur processing to the image. /// Defines a box blur processor of a given Radius.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> public class BoxBlurProcessor : IImageProcessor
internal class BoxBlurProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
{ {
/// <summary> /// <summary>
/// The maximum size of the kernel in either direction. /// The default radius used by the parameterless constructor.
/// </summary> /// </summary>
private readonly int kernelSize; public const int DefaultRadius = 7;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="BoxBlurProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="BoxBlurProcessor"/> class.
/// </summary> /// </summary>
/// <param name="radius"> /// <param name="radius">
/// The 'radius' value representing the size of the area to sample. /// The 'radius' value representing the size of the area to sample.
/// </param> /// </param>
public BoxBlurProcessor(int radius = 7) public BoxBlurProcessor(int radius)
{ {
this.Radius = radius; this.Radius = radius;
this.kernelSize = (radius * 2) + 1;
this.KernelX = this.CreateBoxKernel();
this.KernelY = this.KernelX.Transpose();
} }
/// <summary> /// <summary>
/// Gets the Radius /// Initializes a new instance of the <see cref="BoxBlurProcessor"/> class.
/// </summary> /// </summary>
public int Radius { get; } public BoxBlurProcessor()
: this(DefaultRadius)
/// <summary> {
/// Gets the horizontal gradient operator. }
/// </summary>
public DenseMatrix<float> KernelX { get; }
/// <summary> /// <summary>
/// Gets the vertical gradient operator. /// Gets the Radius.
/// </summary> /// </summary>
public DenseMatrix<float> KernelY { get; } public int Radius { get; }
/// <inheritdoc/>
protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle sourceRectangle, Configuration configuration)
=> new Convolution2PassProcessor<TPixel>(this.KernelX, this.KernelY, false).Apply(source, sourceRectangle, configuration);
/// <summary> /// <inheritdoc />
/// Create a 1 dimensional Box kernel. public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>()
/// </summary> where TPixel : struct, IPixel<TPixel>
/// <returns>The <see cref="DenseMatrix{T}"/></returns>
private DenseMatrix<float> CreateBoxKernel()
{ {
int size = this.kernelSize; return new BoxBlurProcessor<TPixel>(this);
var kernel = new DenseMatrix<float>(size, 1);
kernel.Fill(1F / size);
return kernel;
} }
} }
} }

64
src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor{TPixel}.cs

@ -0,0 +1,64 @@
// // Copyright (c) Six Labors and contributors.
// // Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
/// <summary>
/// Applies box blur processing to the image.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal class BoxBlurProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
{
private readonly BoxBlurProcessor definition;
/// <summary>
/// Initializes a new instance of the <see cref="BoxBlurProcessor{TPixel}"/> class.
/// </summary>
/// <param name="definition">The <see cref="BoxBlurProcessor"/> defining the processor parameters.</param>
public BoxBlurProcessor(BoxBlurProcessor definition)
{
this.definition = definition;
int kernelSize = (definition.Radius * 2) + 1;
this.KernelX = CreateBoxKernel(kernelSize);
this.KernelY = this.KernelX.Transpose();
}
/// <summary>
/// Gets the horizontal gradient operator.
/// </summary>
public DenseMatrix<float> KernelX { get; }
/// <summary>
/// Gets the vertical gradient operator.
/// </summary>
public DenseMatrix<float> KernelY { get; }
/// <inheritdoc/>
protected override void OnFrameApply(
ImageFrame<TPixel> source,
Rectangle sourceRectangle,
Configuration configuration) =>
new Convolution2PassProcessor<TPixel>(this.KernelX, this.KernelY, false).Apply(
source,
sourceRectangle,
configuration);
/// <summary>
/// Create a 1 dimensional Box kernel.
/// </summary>
/// <param name="kernelSize">The maximum size of the kernel in either direction.</param>
/// <returns>The <see cref="DenseMatrix{T}"/>.</returns>
private static DenseMatrix<float> CreateBoxKernel(int kernelSize)
{
var kernel = new DenseMatrix<float>(kernelSize, 1);
kernel.Fill(1F / kernelSize);
return kernel;
}
}
}

82
src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs

@ -4,35 +4,38 @@
using System; using System;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{ {
/// <summary> /// <summary>
/// Applies Gaussian blur processing to the image. /// Defines a gaussian blur processor with a (Sigma, Radius) pair.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam> public class GaussianBlurProcessor : IImageProcessor
internal class GaussianBlurProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
{ {
/// <summary> /// <summary>
/// The maximum size of the kernel in either direction. /// The default value for <see cref="Sigma"/>.
/// </summary> /// </summary>
private readonly int kernelSize; public const float DefaultSigma = 3f;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GaussianBlurProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="GaussianBlurProcessor"/> class.
/// </summary>
public GaussianBlurProcessor()
: this(DefaultSigma, CalculateDefaultRadius(DefaultSigma))
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GaussianBlurProcessor"/> class.
/// </summary> /// </summary>
/// <param name="sigma">The 'sigma' value representing the weight of the blur.</param> /// <param name="sigma">The 'sigma' value representing the weight of the blur.</param>
public GaussianBlurProcessor(float sigma = 3F) public GaussianBlurProcessor(float sigma)
: this(sigma, (int)MathF.Ceiling(sigma * 3)) : this(sigma, CalculateDefaultRadius(sigma))
{ {
// Kernel radius is calculated using the minimum viable value.
// http://chemaguerra.com/gaussian-filter-radius/
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GaussianBlurProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="GaussianBlurProcessor"/> class.
/// </summary> /// </summary>
/// <param name="radius"> /// <param name="radius">
/// The 'radius' value representing the size of the area to sample. /// The 'radius' value representing the size of the area to sample.
@ -43,7 +46,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GaussianBlurProcessor{TPixel}"/> class. /// Initializes a new instance of the <see cref="GaussianBlurProcessor"/> class.
/// </summary> /// </summary>
/// <param name="sigma"> /// <param name="sigma">
/// The 'sigma' value representing the weight of the blur. /// The 'sigma' value representing the weight of the blur.
@ -54,10 +57,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
/// </param> /// </param>
public GaussianBlurProcessor(float sigma, int radius) public GaussianBlurProcessor(float sigma, int radius)
{ {
this.kernelSize = (radius * 2) + 1;
this.Sigma = sigma; this.Sigma = sigma;
this.KernelX = this.CreateGaussianKernel(); this.Radius = radius;
this.KernelY = this.KernelX.Transpose();
} }
/// <summary> /// <summary>
@ -66,47 +67,24 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
public float Sigma { get; } public float Sigma { get; }
/// <summary> /// <summary>
/// Gets the horizontal gradient operator. /// Gets the radius defining the size of the area to sample.
/// </summary>
public DenseMatrix<float> KernelX { get; }
/// <summary>
/// Gets the vertical gradient operator.
/// </summary> /// </summary>
public DenseMatrix<float> KernelY { get; } public int Radius { get; }
/// <inheritdoc/> /// <inheritdoc />
protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle sourceRectangle, Configuration configuration) public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>()
=> new Convolution2PassProcessor<TPixel>(this.KernelX, this.KernelY, false).Apply(source, sourceRectangle, configuration); where TPixel : struct, IPixel<TPixel>
{
return new GaussianBlurProcessor<TPixel>(this);
}
/// <summary> /// <summary>
/// Create a 1 dimensional Gaussian kernel using the Gaussian G(x) function /// Kernel radius is calculated using the minimum viable value.
/// <see cref="http://chemaguerra.com/gaussian-filter-radius/"/>.
/// </summary> /// </summary>
/// <returns>The <see cref="DenseMatrix{T}"/></returns> private static int CalculateDefaultRadius(float sigma)
private DenseMatrix<float> CreateGaussianKernel()
{ {
int size = this.kernelSize; return (int)MathF.Ceiling(sigma * 3);
float weight = this.Sigma;
var kernel = new DenseMatrix<float>(size, 1);
float sum = 0F;
float midpoint = (size - 1) / 2F;
for (int i = 0; i < size; i++)
{
float x = i - midpoint;
float gx = ImageMaths.Gaussian(x, weight);
sum += gx;
kernel[0, i] = gx;
}
// Normalize kernel so that the sum of all weights equals 1
for (int i = 0; i < size; i++)
{
kernel[0, i] /= sum;
}
return kernel;
} }
} }
} }

79
src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor{TPixel}.cs

@ -0,0 +1,79 @@
// // Copyright (c) Six Labors and contributors.
// // Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Processing.Processors.Convolution
{
/// <summary>
/// Applies Gaussian blur processing to an image.
/// </summary>
/// <typeparam name="TPixel">The pixel format.</typeparam>
internal class GaussianBlurProcessor<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
{
private readonly GaussianBlurProcessor definition;
/// <summary>
/// Initializes a new instance of the <see cref="GaussianBlurProcessor{TPixel}"/> class.
/// </summary>
/// <param name="definition">The <see cref="GaussianBlurProcessor"/> defining the processor parameters.</param>
public GaussianBlurProcessor(GaussianBlurProcessor definition)
{
this.definition = definition;
int kernelSize = (definition.Radius * 2) + 1;
this.KernelX = CreateGaussianKernel(kernelSize, definition.Sigma);
this.KernelY = this.KernelX.Transpose();
}
/// <summary>
/// Gets the horizontal gradient operator.
/// </summary>
public DenseMatrix<float> KernelX { get; }
/// <summary>
/// Gets the vertical gradient operator.
/// </summary>
public DenseMatrix<float> KernelY { get; }
/// <inheritdoc/>
protected override void OnFrameApply(
ImageFrame<TPixel> source,
Rectangle sourceRectangle,
Configuration configuration) =>
new Convolution2PassProcessor<TPixel>(this.KernelX, this.KernelY, false).Apply(
source,
sourceRectangle,
configuration);
/// <summary>
/// Create a 1 dimensional Gaussian kernel using the Gaussian G(x) function
/// </summary>
/// <returns>The <see cref="DenseMatrix{T}"/></returns>
private static DenseMatrix<float> CreateGaussianKernel(int size, float weight)
{
var kernel = new DenseMatrix<float>(size, 1);
float sum = 0F;
float midpoint = (size - 1) / 2F;
for (int i = 0; i < size; i++)
{
float x = i - midpoint;
float gx = ImageMaths.Gaussian(x, weight);
sum += gx;
kernel[0, i] = gx;
}
// Normalize kernel so that the sum of all weights equals 1
for (int i = 0; i < size; i++)
{
kernel[0, i] /= sum;
}
return kernel;
}
}
}

6
tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs

@ -14,7 +14,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution
public void BoxBlur_BoxBlurProcessorDefaultsSet() public void BoxBlur_BoxBlurProcessorDefaultsSet()
{ {
this.operations.BoxBlur(); this.operations.BoxBlur();
var processor = this.Verify<BoxBlurProcessor<Rgba32>>(); var processor = this.Verify<BoxBlurProcessor>();
Assert.Equal(7, processor.Radius); Assert.Equal(7, processor.Radius);
} }
@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution
public void BoxBlur_amount_BoxBlurProcessorDefaultsSet() public void BoxBlur_amount_BoxBlurProcessorDefaultsSet()
{ {
this.operations.BoxBlur(34); this.operations.BoxBlur(34);
var processor = this.Verify<BoxBlurProcessor<Rgba32>>(); var processor = this.Verify<BoxBlurProcessor>();
Assert.Equal(34, processor.Radius); Assert.Equal(34, processor.Radius);
} }
@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution
public void BoxBlur_amount_rect_BoxBlurProcessorDefaultsSet() public void BoxBlur_amount_rect_BoxBlurProcessorDefaultsSet()
{ {
this.operations.BoxBlur(5, this.rect); this.operations.BoxBlur(5, this.rect);
var processor = this.Verify<BoxBlurProcessor<Rgba32>>(this.rect); var processor = this.Verify<BoxBlurProcessor>(this.rect);
Assert.Equal(5, processor.Radius); Assert.Equal(5, processor.Radius);
} }

6
tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs

@ -14,7 +14,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution
public void GaussianBlur_GaussianBlurProcessorDefaultsSet() public void GaussianBlur_GaussianBlurProcessorDefaultsSet()
{ {
this.operations.GaussianBlur(); this.operations.GaussianBlur();
var processor = this.Verify<GaussianBlurProcessor<Rgba32>>(); var processor = this.Verify<GaussianBlurProcessor>();
Assert.Equal(3f, processor.Sigma); Assert.Equal(3f, processor.Sigma);
} }
@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution
public void GaussianBlur_amount_GaussianBlurProcessorDefaultsSet() public void GaussianBlur_amount_GaussianBlurProcessorDefaultsSet()
{ {
this.operations.GaussianBlur(0.2f); this.operations.GaussianBlur(0.2f);
var processor = this.Verify<GaussianBlurProcessor<Rgba32>>(); var processor = this.Verify<GaussianBlurProcessor>();
Assert.Equal(.2f, processor.Sigma); Assert.Equal(.2f, processor.Sigma);
} }
@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution
public void GaussianBlur_amount_rect_GaussianBlurProcessorDefaultsSet() public void GaussianBlur_amount_rect_GaussianBlurProcessorDefaultsSet()
{ {
this.operations.GaussianBlur(0.6f, this.rect); this.operations.GaussianBlur(0.6f, this.rect);
var processor = this.Verify<GaussianBlurProcessor<Rgba32>>(this.rect); var processor = this.Verify<GaussianBlurProcessor>(this.rect);
Assert.Equal(.6f, processor.Sigma); Assert.Equal(.6f, processor.Sigma);
} }

Loading…
Cancel
Save