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



Rotates the specified image to straighten it.

Syntax

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

Example

Runs the DeskewCommand on an image and straightens it.

Visual BasicCopy Code
Public Sub DeskewCommandExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Clean.tif")

   ' Prepare the command
   Dim command As DeskewCommand = New DeskewCommand
   'Deskew the image.
   command.Flags = DeskewCommandFlags.DeskewImage Or DeskewCommandFlags.DoNotFillExposedArea

   command.Run(leadImage)

   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void DeskewCommandExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Clean.tif"); 
 
   // Prepare the command 
   DeskewCommand command = new DeskewCommand(); 
   //Deskew the image. 
   command.Flags = DeskewCommandFlags.DeskewImage | DeskewCommandFlags.DoNotFillExposedArea; 
   command.Run(image); 
 
   RasterCodecs.Shutdown(); 
}

Remarks

This command is typically used to automatically straighten scanned images, including bank checks. This command is available in the Document\Medical Toolkits.

  • If the Flags property or the flags parameter of the Constructor contains DeskewCommandFlags.ReturnAngleOnly, the command will update the Angle property without rotating the image.
  • The calculated rotation is limited to 20 degrees in either direction. This command is intended for images, such as scanned documents, that are mainly horizontal lines of text. The results are less predictable with other types of images.
  • This command includes an option to skip deskewing if the angle is very small.
  • This command does not support 12 and 16-bit grayscale and 48 and 64-bit color images. If the image is 12 and 16-bit grayscale and 48 and 64-bit color, the command will not throw an exception.
  • This command does not support signed data images.
  • This command does not support 32-bit grayscale images.
  • This command has been expanded with several flags that can be used to work on bank check images. Different algorithms can be used. For more information, refer to the Remarks section of the DeskewCheckCommand class.
For more information, refer to Introduction to Image Processing With LEADTOOLS.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Core.DeskewCommand

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