←Select platform

DetectDocumentCommand Class

Summary

Detects and returns the points of document's edges in an image.

Syntax
C#
VB
Objective-C
C++
Java
public class DetectDocumentCommand : RasterCommand, IInformationCommand 
Public Class DetectDocumentCommand  
   Inherits RasterCommand 
@interface LTKernelDetectDocumentCommand : LTRasterCommand 
public class DetectDocumentCommand extends RasterCommand 
public ref class DetectDocumentCommand : public RasterCommand 

Remarks
  • For the best results, the document's boundaries should be inside the captured view and have a different background color than the background of the captured view.
  • This command can be used if there is depth (z-axis) deformation as well as deformation along the x- and y- axes.
  • This command supports 12- and 16-bit grayscale and 48- and 64-bit color images. Support for 12- and 16-bit grayscale and 48- and 64-bit color images is available only in the Document/Medical Imaging toolkits.
  • This command supports unsigned data images, but not signed ones.
  • This command does not support 32-bit grayscale images.
  • This function can only process entire images. It does not support regions.

Note: All RasterCommands in this assembly modify the underlying properties of the input RasterImage, including but not limited to:

  • BitsPerPixel
  • Data
  • IsMirrored

If you wish to avoid RasterImage property fidelity loss, pass a clone of your RasterImage to all RasterCommands in this assembly

Example
C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Kernel; 
 
public void DetectDocumentCommandExample() 
{ 
   using (RasterCodecs codecs = new RasterCodecs()) 
   { 
      // Load an image 
      using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PerspectiveDeskew.jpg"))) 
      { 
         DetectDocumentCommand command = new DetectDocumentCommand(); 
         command.Run(image); 
 
         if (command.DocumentArea != null) 
            Console.WriteLine("Document area detected"); 
         else 
            Console.WriteLine("No document detected"); 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Kernel 
 
Public Sub DetectDocumentCommandExample() 
   Using codecs As RasterCodecs = New RasterCodecs() 
      Using image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PerspectiveDeskew.jpg")) 
         Dim command As DetectDocumentCommand = New DetectDocumentCommand() 
         command.Run(image) 
 
         If command.DocumentArea IsNot Nothing Then 
            Console.WriteLine("Document area detected") 
         Else 
            Console.WriteLine("No document detected") 
         End If 
 
      End Using 
   End Using 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 

Requirements

Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Kernel Assembly