LEADTOOLS Image Processing (Leadtools.ImageProcessing.Core assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
AutoBinarizeCommand Class
See Also  Members  
Leadtools.ImageProcessing.Core Namespace : AutoBinarizeCommand Class



This function applies binary segmentation to a bitmap automatically. Supported in Silverlight, Windows Phone 7

Object Model

AutoBinarizeCommand Class

Syntax

Visual Basic (Declaration) 
Public Class AutoBinarizeCommand 
   Inherits Leadtools.ImageProcessing.RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As AutoBinarizeCommand
C# 
public class AutoBinarizeCommand : Leadtools.ImageProcessing.RasterCommand, IRasterCommand  
C++/CLI 
public ref class AutoBinarizeCommand : public Leadtools.ImageProcessing.RasterCommand, IRasterCommand  

Example

Runs the AutoBinarizeCommand on an image and converts it to a bitonal image.

Visual BasicCopy Code
Public Sub AutoBinarizeCommandExample()
   ' Load an image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample.mrc"))

   Dim command As AutoBinarizeCommand = New AutoBinarizeCommand()
   command.Run(image)

End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
C#Copy Code
public void AutoBinarizeCommandExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample.mrc"));

      AutoBinarizeCommand command = new AutoBinarizeCommand();
      command.Run(image);

   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
SilverlightCSharpCopy Code
public void AutoBinarizeCommandExample(RasterImage image, Stream outStream)
{
   AutoBinarizeCommand command = new AutoBinarizeCommand();
   command.Run(image);
   // Save result image
   RasterCodecs codecs = new RasterCodecs();
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);
   image.Dispose();
}
SilverlightVBCopy Code
Public Sub AutoBinarizeCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)
   Dim command As AutoBinarizeCommand = New AutoBinarizeCommand()
   command.Run(image)
   ' Save result image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)
   image.Dispose()
End Sub

Remarks

  • This function is useful for improving recognition results (OCR, Barcode, OMR, ICR).
  • This command does not support 12- or 16-bit grayscale or 48- or 64-bit color images (Exception: Image format not recognized).
  • This command does not support signed data images (Exception: Signed image data not supported).
  • This command does not support 32-bit grayscale images.
Options:
  • Automatic pre-processing
  • Pre-processing using background elimination
  • Pre-processing using color leveling
  • Perform automatic, percentile or median threshold
  • Manually specify a threshold value

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Core.AutoBinarizeCommand

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also