Browse Source

BinaryThresholdColorComponent -> BinaryThresholdMode

pull/1557/head
Anton Firszov 5 years ago
parent
commit
2e09bb4a3c
  1. 10
      src/ImageSharp/Processing/BinaryThresholdMode.cs
  2. 32
      src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs
  3. 22
      src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs
  4. 16
      src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
  5. 40
      tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs
  6. 8
      tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs

10
src/ImageSharp/Processing/BinaryThresholdColorComponent.cs → src/ImageSharp/Processing/BinaryThresholdMode.cs

@ -4,22 +4,22 @@
namespace SixLabors.ImageSharp.Processing
{
/// <summary>
/// The color component to be compared to threshold.
/// Selects the value to be compared to threshold.
/// </summary>
public enum BinaryThresholdColorComponent : int
public enum BinaryThresholdMode
{
/// <summary>
/// Luminance color component according to ITU-R Recommendation BT.709.
/// Compare the color luminance (according to ITU-R Recommendation BT.709).
/// </summary>
Luminance = 0,
/// <summary>
/// HSL saturation color component.
/// Compare the HSL saturation of the color.
/// </summary>
Saturation = 1,
/// <summary>
/// Maximum of YCbCr chroma value, i.e. Cb and Cr distance from achromatic value.
/// Compare the maximum of YCbCr chroma value, i.e. Cb and Cr distance from achromatic value.
/// </summary>
MaxChroma = 2,
}

32
src/ImageSharp/Processing/Extensions/Binarization/BinaryThresholdExtensions.cs

@ -19,20 +19,20 @@ namespace SixLabors.ImageSharp.Processing
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BinaryThreshold(this IImageProcessingContext source, float threshold)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdColorComponent.Luminance));
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdMode.Luminance));
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="colorComponent">The color component to be compared to threshold.</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
BinaryThresholdColorComponent colorComponent)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, colorComponent));
BinaryThresholdMode mode)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, mode));
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold with
@ -48,14 +48,14 @@ namespace SixLabors.ImageSharp.Processing
this IImageProcessingContext source,
float threshold,
Rectangle rectangle)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdColorComponent.Luminance), rectangle);
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, BinaryThresholdMode.Luminance), rectangle);
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
/// </summary>
/// <param name="source">The image this method extends.</param>
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="colorComponent">The color component to be compared to threshold.</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
@ -63,9 +63,9 @@ namespace SixLabors.ImageSharp.Processing
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
BinaryThresholdColorComponent colorComponent,
BinaryThresholdMode mode,
Rectangle rectangle)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, colorComponent), rectangle);
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, mode), rectangle);
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold with
@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.Processing
float threshold,
Color upperColor,
Color lowerColor)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance));
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdMode.Luminance));
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
@ -90,15 +90,15 @@ namespace SixLabors.ImageSharp.Processing
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <param name="colorComponent">The color component to be compared to threshold.</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <returns>The <see cref="IImageProcessingContext"/> to allow chaining of operations.</returns>
public static IImageProcessingContext BinaryThreshold(
this IImageProcessingContext source,
float threshold,
Color upperColor,
Color lowerColor,
BinaryThresholdColorComponent colorComponent)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, colorComponent));
BinaryThresholdMode mode)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, mode));
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold with
@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp.Processing
Color upperColor,
Color lowerColor,
Rectangle rectangle)
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance), rectangle);
=> source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, BinaryThresholdMode.Luminance), rectangle);
/// <summary>
/// Applies binarization to the image splitting the pixels at the given threshold.
@ -127,7 +127,7 @@ namespace SixLabors.ImageSharp.Processing
/// <param name="threshold">The threshold to apply binarization of the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold</param>
/// <param name="colorComponent">The color component to be compared to threshold.</param>
/// <param name="mode">Selects the value to be compared to threshold.</param>
/// <param name="rectangle">
/// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
/// </param>
@ -137,8 +137,8 @@ namespace SixLabors.ImageSharp.Processing
float threshold,
Color upperColor,
Color lowerColor,
BinaryThresholdColorComponent colorComponent,
BinaryThresholdMode mode,
Rectangle rectangle) =>
source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, colorComponent), rectangle);
source.ApplyProcessor(new BinaryThresholdProcessor(threshold, upperColor, lowerColor, mode), rectangle);
}
}

22
src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs

@ -14,9 +14,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
/// Initializes a new instance of the <see cref="BinaryThresholdProcessor"/> class.
/// </summary>
/// <param name="threshold">The threshold to split the image. Must be between 0 and 1.</param>
/// <param name="colorComponent">The color component to be compared to threshold.</param>
public BinaryThresholdProcessor(float threshold, BinaryThresholdColorComponent colorComponent)
: this(threshold, Color.White, Color.Black, colorComponent)
/// <param name="mode">The color component to be compared to threshold.</param>
public BinaryThresholdProcessor(float threshold, BinaryThresholdMode mode)
: this(threshold, Color.White, Color.Black, mode)
{
}
@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
/// </summary>
/// <param name="threshold">The threshold to split the image. Must be between 0 and 1.</param>
public BinaryThresholdProcessor(float threshold)
: this(threshold, Color.White, Color.Black, BinaryThresholdColorComponent.Luminance)
: this(threshold, Color.White, Color.Black, BinaryThresholdMode.Luminance)
{
}
@ -36,14 +36,14 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
/// <param name="threshold">The threshold to split the image. Must be between 0 and 1.</param>
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold.</param>
/// <param name="colorComponent">The color component to be compared to threshold.</param>
public BinaryThresholdProcessor(float threshold, Color upperColor, Color lowerColor, BinaryThresholdColorComponent colorComponent)
/// <param name="mode">The color component to be compared to threshold.</param>
public BinaryThresholdProcessor(float threshold, Color upperColor, Color lowerColor, BinaryThresholdMode mode)
{
Guard.MustBeBetweenOrEqualTo(threshold, 0, 1, nameof(threshold));
this.Threshold = threshold;
this.UpperColor = upperColor;
this.LowerColor = lowerColor;
this.ColorComponent = colorComponent;
this.Mode = mode;
}
/// <summary>
@ -54,7 +54,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
/// <param name="upperColor">The color to use for pixels that are above the threshold.</param>
/// <param name="lowerColor">The color to use for pixels that are below the threshold.</param>
public BinaryThresholdProcessor(float threshold, Color upperColor, Color lowerColor)
: this(threshold, upperColor, lowerColor, BinaryThresholdColorComponent.Luminance)
: this(threshold, upperColor, lowerColor, BinaryThresholdMode.Luminance)
{
}
@ -73,10 +73,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
/// </summary>
public Color LowerColor { get; }
/// <summary>
/// Gets a value indicating whether to use saturation value instead of luminance.
/// <summary>
/// Gets a value indicating the value to be compared to threshold.
/// </summary>
public BinaryThresholdColorComponent ColorComponent { get; }
public BinaryThresholdMode Mode { get; }
/// <inheritdoc />
public IImageProcessor<TPixel> CreatePixelSpecificProcessor<TPixel>(Configuration configuration, Image<TPixel> source, Rectangle sourceRectangle)

16
src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
upper,
lower,
threshold,
this.definition.ColorComponent,
this.definition.Mode,
configuration);
ParallelRowIterator.IterateRows<RowOperation, Rgb24>(
@ -63,7 +63,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
private readonly TPixel upper;
private readonly TPixel lower;
private readonly byte threshold;
private readonly BinaryThresholdColorComponent colorComponent;
private readonly BinaryThresholdMode mode;
private readonly int startX;
private readonly Configuration configuration;
@ -74,7 +74,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
TPixel upper,
TPixel lower,
byte threshold,
BinaryThresholdColorComponent colorComponent,
BinaryThresholdMode mode,
Configuration configuration)
{
this.startX = startX;
@ -82,7 +82,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
this.upper = upper;
this.lower = lower;
this.threshold = threshold;
this.colorComponent = colorComponent;
this.mode = mode;
this.configuration = configuration;
}
@ -96,9 +96,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
Span<TPixel> rowSpan = this.source.GetPixelRowSpan(y).Slice(this.startX, span.Length);
PixelOperations<TPixel>.Instance.ToRgb24(this.configuration, rowSpan, span);
switch (this.colorComponent)
switch (this.mode)
{
case BinaryThresholdColorComponent.Luminance:
case BinaryThresholdMode.Luminance:
{
byte threshold = this.threshold;
for (int x = 0; x < rowSpan.Length; x++)
@ -112,7 +112,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
break;
}
case BinaryThresholdColorComponent.Saturation:
case BinaryThresholdMode.Saturation:
{
float threshold = this.threshold / 255F;
for (int x = 0; x < rowSpan.Length; x++)
@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
break;
}
case BinaryThresholdColorComponent.MaxChroma:
case BinaryThresholdMode.MaxChroma:
{
float threshold = this.threshold / 2F;
for (int x = 0; x < rowSpan.Length; x++)

40
tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
this.operations.BinaryThreshold(.23f);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>();
Assert.Equal(.23f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Luminance, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Luminance, p.Mode);
Assert.Equal(Color.White, p.UpperColor);
Assert.Equal(Color.Black, p.LowerColor);
}
@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
this.operations.BinaryThreshold(.93f, this.rect);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>(this.rect);
Assert.Equal(.93f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Luminance, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Luminance, p.Mode);
Assert.Equal(Color.White, p.UpperColor);
Assert.Equal(Color.Black, p.LowerColor);
}
@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
this.operations.BinaryThreshold(.23f, Color.HotPink, Color.Yellow);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>();
Assert.Equal(.23f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Luminance, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Luminance, p.Mode);
Assert.Equal(Color.HotPink, p.UpperColor);
Assert.Equal(Color.Yellow, p.LowerColor);
}
@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
this.operations.BinaryThreshold(.93f, Color.HotPink, Color.Yellow, this.rect);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>(this.rect);
Assert.Equal(BinaryThresholdColorComponent.Luminance, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Luminance, p.Mode);
Assert.Equal(.93f, p.Threshold);
Assert.Equal(Color.HotPink, p.UpperColor);
Assert.Equal(Color.Yellow, p.LowerColor);
@ -57,10 +57,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinarySaturationThreshold_CorrectProcessor()
{
this.operations.BinaryThreshold(.23f, BinaryThresholdColorComponent.Saturation);
this.operations.BinaryThreshold(.23f, BinaryThresholdMode.Saturation);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>();
Assert.Equal(.23f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Saturation, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Saturation, p.Mode);
Assert.Equal(Color.White, p.UpperColor);
Assert.Equal(Color.Black, p.LowerColor);
}
@ -68,10 +68,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinarySaturationThreshold_rect_CorrectProcessor()
{
this.operations.BinaryThreshold(.93f, BinaryThresholdColorComponent.Saturation, this.rect);
this.operations.BinaryThreshold(.93f, BinaryThresholdMode.Saturation, this.rect);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>(this.rect);
Assert.Equal(.93f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Saturation, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Saturation, p.Mode);
Assert.Equal(Color.White, p.UpperColor);
Assert.Equal(Color.Black, p.LowerColor);
}
@ -79,10 +79,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinarySaturationThreshold_CorrectProcessorWithUpperLower()
{
this.operations.BinaryThreshold(.23f, Color.HotPink, Color.Yellow, BinaryThresholdColorComponent.Saturation);
this.operations.BinaryThreshold(.23f, Color.HotPink, Color.Yellow, BinaryThresholdMode.Saturation);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>();
Assert.Equal(.23f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Saturation, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Saturation, p.Mode);
Assert.Equal(Color.HotPink, p.UpperColor);
Assert.Equal(Color.Yellow, p.LowerColor);
}
@ -90,10 +90,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinarySaturationThreshold_rect_CorrectProcessorWithUpperLower()
{
this.operations.BinaryThreshold(.93f, Color.HotPink, Color.Yellow, BinaryThresholdColorComponent.Saturation, this.rect);
this.operations.BinaryThreshold(.93f, Color.HotPink, Color.Yellow, BinaryThresholdMode.Saturation, this.rect);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>(this.rect);
Assert.Equal(.93f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.Saturation, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.Saturation, p.Mode);
Assert.Equal(Color.HotPink, p.UpperColor);
Assert.Equal(Color.Yellow, p.LowerColor);
}
@ -101,10 +101,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinaryMaxChromaThreshold_CorrectProcessor()
{
this.operations.BinaryThreshold(.23f, BinaryThresholdColorComponent.MaxChroma);
this.operations.BinaryThreshold(.23f, BinaryThresholdMode.MaxChroma);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>();
Assert.Equal(.23f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.MaxChroma, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.MaxChroma, p.Mode);
Assert.Equal(Color.White, p.UpperColor);
Assert.Equal(Color.Black, p.LowerColor);
}
@ -112,10 +112,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinaryMaxChromaThreshold_rect_CorrectProcessor()
{
this.operations.BinaryThreshold(.93f, BinaryThresholdColorComponent.MaxChroma, this.rect);
this.operations.BinaryThreshold(.93f, BinaryThresholdMode.MaxChroma, this.rect);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>(this.rect);
Assert.Equal(.93f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.MaxChroma, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.MaxChroma, p.Mode);
Assert.Equal(Color.White, p.UpperColor);
Assert.Equal(Color.Black, p.LowerColor);
}
@ -123,10 +123,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinaryMaxChromaThreshold_CorrectProcessorWithUpperLower()
{
this.operations.BinaryThreshold(.23f, Color.HotPink, Color.Yellow, BinaryThresholdColorComponent.MaxChroma);
this.operations.BinaryThreshold(.23f, Color.HotPink, Color.Yellow, BinaryThresholdMode.MaxChroma);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>();
Assert.Equal(.23f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.MaxChroma, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.MaxChroma, p.Mode);
Assert.Equal(Color.HotPink, p.UpperColor);
Assert.Equal(Color.Yellow, p.LowerColor);
}
@ -134,10 +134,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
[Fact]
public void BinaryMaxChromaThreshold_rect_CorrectProcessorWithUpperLower()
{
this.operations.BinaryThreshold(.93f, Color.HotPink, Color.Yellow, BinaryThresholdColorComponent.MaxChroma, this.rect);
this.operations.BinaryThreshold(.93f, Color.HotPink, Color.Yellow, BinaryThresholdMode.MaxChroma, this.rect);
BinaryThresholdProcessor p = this.Verify<BinaryThresholdProcessor>(this.rect);
Assert.Equal(.93f, p.Threshold);
Assert.Equal(BinaryThresholdColorComponent.MaxChroma, p.ColorComponent);
Assert.Equal(BinaryThresholdMode.MaxChroma, p.Mode);
Assert.Equal(Color.HotPink, p.UpperColor);
Assert.Equal(Color.Yellow, p.LowerColor);
}

8
tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs

@ -63,7 +63,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
using (Image<TPixel> image = provider.GetImage())
{
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdColorComponent.Saturation));
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.Saturation));
image.DebugSave(provider, value);
image.CompareToReferenceOutput(ImageComparer.Exact, provider, value.ToString("0.00", NumberFormatInfo.InvariantInfo));
}
@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
var bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8);
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdColorComponent.Saturation, bounds));
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.Saturation, bounds));
image.DebugSave(provider, value);
image.CompareToReferenceOutput(ImageComparer.Exact, provider, value.ToString("0.00", NumberFormatInfo.InvariantInfo));
}
@ -92,7 +92,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
using (Image<TPixel> image = provider.GetImage())
{
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdColorComponent.MaxChroma));
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.MaxChroma));
image.DebugSave(provider, value);
if (!TestEnvironment.Is64BitProcess && TestEnvironment.IsFramework)
@ -117,7 +117,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
{
var bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8);
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdColorComponent.MaxChroma, bounds));
image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.MaxChroma, bounds));
image.DebugSave(provider, value);
if (!TestEnvironment.Is64BitProcess && TestEnvironment.IsFramework)

Loading…
Cancel
Save