Binarization Свойство (BorderClearCommand)
Возвращает или задает
ProcessingCommandBase, который используется для бинаризации исходного цветного изображения перед обработкой изображения.
Вот пример, который задает пользовательскую бинаризацию для BorderClearCommand:
''' <summary>
''' Executes the BorderClearCommand on a color image.
''' </summary>
''' <param name="image">The image that should be processed.</param>
Public Sub BorderClear(image As Vintasoft.Imaging.VintasoftImage)
' create the border clear command
Dim command As New Vintasoft.Imaging.ImageProcessing.Document.BorderClearCommand()
' create AdvancedReplaceColorCommand that will be used for improving the binarization of a color image that is acquired from image scanner
Dim replaceGrayGradient As Vintasoft.Imaging.ImageProcessing.Document.AdvancedReplaceColorCommand = Vintasoft.Imaging.ImageProcessing.Document.AdvancedReplaceColorCommand.CreateColorGradientBinarizationCommand(New Vintasoft.Imaging.ImageColors.Rgb24Color(0, 0, 0), New Vintasoft.Imaging.ImageColors.Rgb24Color(64, 64, 64), 64)
' specify that the border clear command should improve the binarization of image before detecting an image border
command.Binarization = New Vintasoft.Imaging.ImageProcessing.CompositeCommand(replaceGrayGradient, New Vintasoft.Imaging.ImageProcessing.ChangePixelFormatToBlackWhiteCommand())
' apply the border clear command to an image
command.ExecuteInPlace(image)
End Sub
/// <summary>
/// Executes the BorderClearCommand on a color image.
/// </summary>
/// <param name="image">The image that should be processed.</param>
public void BorderClear(Vintasoft.Imaging.VintasoftImage image)
{
// create the border clear command
Vintasoft.Imaging.ImageProcessing.Document.BorderClearCommand command =
new Vintasoft.Imaging.ImageProcessing.Document.BorderClearCommand();
// create AdvancedReplaceColorCommand that will be used for improving the binarization of a color image that is acquired from image scanner
Vintasoft.Imaging.ImageProcessing.Document.AdvancedReplaceColorCommand replaceGrayGradient =
Vintasoft.Imaging.ImageProcessing.Document.AdvancedReplaceColorCommand.CreateColorGradientBinarizationCommand(
new Vintasoft.Imaging.ImageColors.Rgb24Color(0, 0, 0),
new Vintasoft.Imaging.ImageColors.Rgb24Color(64, 64, 64),
64);
// specify that the border clear command should improve the binarization of image before detecting an image border
command.Binarization = new Vintasoft.Imaging.ImageProcessing.CompositeCommand(
replaceGrayGradient,
new Vintasoft.Imaging.ImageProcessing.ChangePixelFormatToBlackWhiteCommand());
// apply the border clear command to an image
command.ExecuteInPlace(image);
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5