VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.ImageProcessing.Document Namespace / BorderClearCommand Class / Binarization Property
Syntax Exceptions Example Requirements SeeAlso
In This Topic
    Binarization Property (BorderClearCommand)
    In This Topic
    Gets or sets ProcessingCommandBase that is used for binarization of the color source image before image processing.
    Syntax
    '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); }
    Exceptions
    ExceptionDescription
    Thrown if value is null.
    Example

    Here is an example that sets custom binarization for 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);
    }
    
    

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also