@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Processing ;
@ -16,6 +16,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
this . operations . BinaryThreshold ( . 2 3f ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( ) ;
Assert . Equal ( . 2 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Luminance , p . ColorComponent ) ;
Assert . Equal ( Color . White , p . UpperColor ) ;
Assert . Equal ( Color . Black , p . LowerColor ) ;
}
@ -26,6 +27,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
this . operations . BinaryThreshold ( . 9 3f , this . rect ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( this . rect ) ;
Assert . Equal ( . 9 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Luminance , p . ColorComponent ) ;
Assert . Equal ( Color . White , p . UpperColor ) ;
Assert . Equal ( Color . Black , p . LowerColor ) ;
}
@ -36,6 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
this . operations . BinaryThreshold ( . 2 3f , Color . HotPink , Color . Yellow ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( ) ;
Assert . Equal ( . 2 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Luminance , p . ColorComponent ) ;
Assert . Equal ( Color . HotPink , p . UpperColor ) ;
Assert . Equal ( Color . Yellow , p . LowerColor ) ;
}
@ -45,9 +48,98 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
this . operations . BinaryThreshold ( . 9 3f , Color . HotPink , Color . Yellow , this . rect ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( this . rect ) ;
Assert . Equal ( BinaryThresholdColorComponent . Luminance , p . ColorComponent ) ;
Assert . Equal ( . 9 3f , p . Threshold ) ;
Assert . Equal ( Color . HotPink , p . UpperColor ) ;
Assert . Equal ( Color . Yellow , p . LowerColor ) ;
}
[Fact]
public void BinarySaturationThreshold_CorrectProcessor ( )
{
this . operations . BinaryThreshold ( . 2 3f , BinaryThresholdColorComponent . Saturation ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( ) ;
Assert . Equal ( . 2 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Saturation , p . ColorComponent ) ;
Assert . Equal ( Color . White , p . UpperColor ) ;
Assert . Equal ( Color . Black , p . LowerColor ) ;
}
[Fact]
public void BinarySaturationThreshold_rect_CorrectProcessor ( )
{
this . operations . BinaryThreshold ( . 9 3f , BinaryThresholdColorComponent . Saturation , this . rect ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( this . rect ) ;
Assert . Equal ( . 9 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Saturation , p . ColorComponent ) ;
Assert . Equal ( Color . White , p . UpperColor ) ;
Assert . Equal ( Color . Black , p . LowerColor ) ;
}
[Fact]
public void BinarySaturationThreshold_CorrectProcessorWithUpperLower ( )
{
this . operations . BinaryThreshold ( . 2 3f , Color . HotPink , Color . Yellow , BinaryThresholdColorComponent . Saturation ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( ) ;
Assert . Equal ( . 2 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Saturation , p . ColorComponent ) ;
Assert . Equal ( Color . HotPink , p . UpperColor ) ;
Assert . Equal ( Color . Yellow , p . LowerColor ) ;
}
[Fact]
public void BinarySaturationThreshold_rect_CorrectProcessorWithUpperLower ( )
{
this . operations . BinaryThreshold ( . 9 3f , Color . HotPink , Color . Yellow , BinaryThresholdColorComponent . Saturation , this . rect ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( this . rect ) ;
Assert . Equal ( . 9 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . Saturation , p . ColorComponent ) ;
Assert . Equal ( Color . HotPink , p . UpperColor ) ;
Assert . Equal ( Color . Yellow , p . LowerColor ) ;
}
[Fact]
public void BinaryMaxChromaThreshold_CorrectProcessor ( )
{
this . operations . BinaryThreshold ( . 2 3f , BinaryThresholdColorComponent . MaxChroma ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( ) ;
Assert . Equal ( . 2 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . MaxChroma , p . ColorComponent ) ;
Assert . Equal ( Color . White , p . UpperColor ) ;
Assert . Equal ( Color . Black , p . LowerColor ) ;
}
[Fact]
public void BinaryMaxChromaThreshold_rect_CorrectProcessor ( )
{
this . operations . BinaryThreshold ( . 9 3f , BinaryThresholdColorComponent . MaxChroma , this . rect ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( this . rect ) ;
Assert . Equal ( . 9 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . MaxChroma , p . ColorComponent ) ;
Assert . Equal ( Color . White , p . UpperColor ) ;
Assert . Equal ( Color . Black , p . LowerColor ) ;
}
[Fact]
public void BinaryMaxChromaThreshold_CorrectProcessorWithUpperLower ( )
{
this . operations . BinaryThreshold ( . 2 3f , Color . HotPink , Color . Yellow , BinaryThresholdColorComponent . MaxChroma ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( ) ;
Assert . Equal ( . 2 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . MaxChroma , p . ColorComponent ) ;
Assert . Equal ( Color . HotPink , p . UpperColor ) ;
Assert . Equal ( Color . Yellow , p . LowerColor ) ;
}
[Fact]
public void BinaryMaxChromaThreshold_rect_CorrectProcessorWithUpperLower ( )
{
this . operations . BinaryThreshold ( . 9 3f , Color . HotPink , Color . Yellow , BinaryThresholdColorComponent . MaxChroma , this . rect ) ;
BinaryThresholdProcessor p = this . Verify < BinaryThresholdProcessor > ( this . rect ) ;
Assert . Equal ( . 9 3f , p . Threshold ) ;
Assert . Equal ( BinaryThresholdColorComponent . MaxChroma , p . ColorComponent ) ;
Assert . Equal ( Color . HotPink , p . UpperColor ) ;
Assert . Equal ( Color . Yellow , p . LowerColor ) ;
}
}
}
}