VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.ImageProcessing.Document Namespace / BorderClearCommand Class / Binarization Property
Синтаксис Exceptions Example Требования Смотрите также
В этом разделе
    Binarization Свойство (BorderClearCommand)
    В этом разделе
    Возвращает или задает ProcessingCommandBase, который используется для бинаризации исходного цветного изображения перед обработкой изображения.
    Синтаксис
    'Declaration
    
    <TypeConverterAttribute(Vintasoft.Imaging.TypeConverters.SimpleTypeConverter)>
    <DescriptionAttribute("The Processing Command that is used for binarization of the color source image before image processing.")>
    Public Property Binarization As Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
    
    
    [TypeConverter(Vintasoft.Imaging.TypeConverters.SimpleTypeConverter)]
    [Description("The Processing Command that is used for binarization of the color source image before image processing.")]
    public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase Binarization { get; set; }
    
    
    [TypeConverter(Vintasoft.Imaging.TypeConverters.SimpleTypeConverter)]
    [Description("The Processing Command that is used for binarization of the color source image before image processing.")]
    public: __property Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase* get_Binarization();
    public: __property void set_Binarization(
    Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase* value
    );
    [TypeConverter(Vintasoft.Imaging.TypeConverters.SimpleTypeConverter)]
    [Description("The Processing Command that is used for binarization of the color source image before image processing.")]
    public:
    property Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase^ Binarization { Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase^ get(); void set(Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase^ value); }
    Исключения
    ИсключениеОписание
    Выбрасывается, если 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 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

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