Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
DeskewCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.Core Namespace : DeskewCommand 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 DeskewCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As DeskewCommand
C# 
public class DeskewCommand : RasterCommand, IRasterCommand  
Managed Extensions for C++ 
public __gc class DeskewCommand : public RasterCommand, IRasterCommand  
C++/CLI 
public ref class DeskewCommand : public RasterCommand, IRasterCommand  

Example

Visual BasicCopy Code
ImageProcessing.Core.DeskewCommand
   Public Sub DeskewCommandExample()
      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 DeskewCommand = New DeskewCommand
      'Deskew the image.
      command.Flags = DeskewCommandFlags.DeskewImage Or DeskewCommandFlags.DoNotFillExposedArea

      command.Run(leadImage)

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Core.DeskewCommand 
      public void DeskewCommandExample() 
      { 
         // 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 
         DeskewCommand command = new DeskewCommand(); 
         //Deskew the image. 
         command.Flags = DeskewCommandFlags.DeskewImage | DeskewCommandFlags.DoNotFillExposedArea; 
         command.Run(image); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • 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.
For more information, refer to Processing an Image.

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