VintaSoft Imaging .NET SDK 15.2: Документация для .NET разработчика
Vintasoft.Imaging.ImageProcessing.Document Namespace / BorderClearCommand Class / Binarization Property
Синтаксис Exceptions Example Требования Смотрите также
В этом разделе
Binarization Свойство (BorderClearCommand)
В этом разделе
Возвращает или задает ProcessingCommandBase, который используется для бинаризации исходного цветного изображения перед обработкой изображения.
Синтаксис
'Declaration

<DescriptionAttribute("The Processing Command that is used for binarization of the color source image before image processing.")>
<TypeConverterAttribute(Vintasoft.Imaging.TypeConverters.SimpleTypeConverter)>
Public Property Binarization As Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase

[Description("The Processing Command that is used for binarization of the color source image before image processing.")]
[TypeConverter(Vintasoft.Imaging.TypeConverters.SimpleTypeConverter)]
public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase Binarization { get; set; }

Исключения
ИсключениеОписание
Выбрасывается, если value равно null.
Пример

Вот пример, который задает пользовательскую бинаризацию для 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 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также