a
This commit is contained in:
@@ -17,4 +17,11 @@ public class AutoThresholdProcessor : SingleImageProcessor
|
||||
image.AutoThreshold(_method);
|
||||
return image;
|
||||
}
|
||||
|
||||
#region Overrides of Object
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"{nameof(AutoThresholdProcessor)}({_method})";
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -5,16 +5,27 @@ namespace Ocr.Tesseract.Screenshots.Threshold;
|
||||
|
||||
public class ThresholdAdaptiveProcessor : SingleImageProcessor
|
||||
{
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
|
||||
public ThresholdAdaptiveProcessor(int width, int height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
public ThresholdAdaptiveProcessor(int size) : this(size, size)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override MagickImage Process(MagickImage image) => image
|
||||
.ThresholdAdaptive(_width, _height);
|
||||
}
|
||||
public ThresholdAdaptiveProcessor(int width, int height)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override MagickImage Process(MagickImage image) => image
|
||||
.ThresholdAdaptive(_width, _height);
|
||||
|
||||
#region Overrides of Object
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"{nameof(ThresholdAdaptiveProcessor)}({_width:D2}_{_height:D2})";
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -4,18 +4,25 @@ namespace Ocr.Tesseract.Screenshots.Threshold;
|
||||
|
||||
public class ThresholdProcessor : SingleImageProcessor
|
||||
{
|
||||
private readonly Percentage _percentage;
|
||||
private readonly Percentage _percentage;
|
||||
|
||||
|
||||
public ThresholdProcessor(int percentage)
|
||||
{
|
||||
_percentage = new Percentage(percentage);
|
||||
}
|
||||
public ThresholdProcessor(int percentage)
|
||||
{
|
||||
_percentage = new Percentage(percentage);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override MagickImage Process(MagickImage image)
|
||||
{
|
||||
image.Threshold(_percentage);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc />
|
||||
protected override MagickImage Process(MagickImage image)
|
||||
{
|
||||
image.Threshold(_percentage);
|
||||
return image;
|
||||
}
|
||||
|
||||
#region Overrides of Object
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"{nameof(ThresholdProcessor)}({_percentage})";
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ImageMagick;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ocr.Tesseract.Models;
|
||||
|
||||
@@ -26,6 +27,7 @@ public struct ScanResult
|
||||
/// <summary>
|
||||
/// Value referenced by <see cref="Word"/>
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public MagickImage Image { get; set; }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user