Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
DeskewCheckCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.Core Namespace : DeskewCheckCommand Class




Rotates the specified image to straighten it. This command is typically used to automatically straighten scanned images. This command is available in the Document\Medical Toolkits.

Syntax

Visual Basic (Declaration) 
Public Class DeskewCheckCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As DeskewCheckCommand
C# 
public class DeskewCheckCommand : RasterCommand, IRasterCommand  
Managed Extensions for C++ 
public __gc class DeskewCheckCommand : public RasterCommand, IRasterCommand  
C++/CLI 
public ref class DeskewCheckCommand : public RasterCommand, IRasterCommand  

Example

Visual BasicCopy Code
ImageProcessing.Core.DeskewCheckCommand
   Public Sub DeskewCheckCommandExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Clean.tif")

      ' Prepare the command
      Dim command As DeskewCheckCommand = New DeskewCheckCommand
      'Deskew the image.
      command.Flags = DeskewCheckCommandFlags.DeskewImage Or DeskewCheckCommandFlags.DoNotFillExposedArea Or DeskewCheckCommandFlags.UseLineDetectionToDeskewCheck

      command.Run(leadImage)

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Core.DeskewCheckCommand 
      public void DeskewCheckCommandExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Clean.tif"); 
 
         // Prepare the command 
         DeskewCheckCommand command = new DeskewCheckCommand(); 
         //Deskew the image. 
         command.Flags = DeskewCheckCommandFlags.DeskewImage | DeskewCheckCommandFlags.DoNotFillExposedArea; 
         command.Run(image); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • Like the DeskewCommand, you can use this method to automatically straighten scanned documents. With this command, the DeskewCommand class has been extended to work especially on bank check images. Different algorithms can be used (the normal deskew algorithm, a special bank check algorithm and a special line detection algorithm).
  • If the Flags property or the flags parameter of the Constructor contains DeskewCheckCommandFlags.ReturnAngleOnly, the command will update the Angle property without rotating the image.
  • This command includes an option to skip deskewing if the angle is very small.
  • The amount of rotation is limited to a maximum of 20 degrees in either direction. This command is intended for images, like scanned bank checks, that are mainly horizontal lines of text. The results are less predictable with other types of images.
  • This command does not support 12- or 16-bit grayscale or 48- or 64-bit color images, but will not throw an exception.
  • This command does not support signed data images.
  • This command does not support 32-bit grayscale images.
The following images demonstrate the use of the DeskewCheckCommand command on color, grayscale, and 1-bit images.

The original color image is shown in the following figure:

The deskewed color image is shown in the following figure:

The original grayscale image is shown in the following figure:

The deskewed grayscale image is shown in the following figure:

The original 1-bit image is shown in the following figure:

The deskewed 1-bit image is shown in the following figure:

For more information, refer to Processing an Image and Deskewing.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Core.DeskewCheckCommand

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also