DocumentPerspectiveCorrectionCommand Class
In This Topic
Corrects the perspective distortion in document image, removes border in document image and deskews the document image.
Object Model
Syntax
Remarks
This image processing command should be used to process image that contains document with visible borders.
If document image is captured using a camera, command can correct the perspective distortion in document image, remove border in document image and deskew the document image.
If document image is acquired from image scanner, command can remove border in document image and deskew the document image.
Example
This C#/VB.NET code shows how to load an image from disk, correct the perspective distortion in document image and save the result to a new image file.
''' <summary>
''' Corrects perspective distortion of document image.
''' </summary>
''' <param name="sourceFile">Source image file.</param>
''' <param name="resultFile">Result image file.</param>
Public Sub ApplyPerspectiveCorrection(sourceFile As String, resultFile As String)
Using image As New Vintasoft.Imaging.VintasoftImage(sourceFile)
' create the perspective correction command
Dim command As New Vintasoft.Imaging.ImageProcessing.Document.DocumentPerspectiveCorrectionCommand()
' apply the perspective correction to a document image
command.ExecuteInPlace(image)
' save the result image to a file
image.Save(resultFile)
End Using
End Sub
/// <summary>
/// Corrects perspective distortion of document image.
/// </summary>
/// <param name="sourceFile">Source image file.</param>
/// <param name="resultFile">Result image file.</param>
public void ApplyPerspectiveCorrection(string sourceFile, string resultFile)
{
using (Vintasoft.Imaging.VintasoftImage image =
new Vintasoft.Imaging.VintasoftImage(sourceFile))
{
// create the perspective correction command
Vintasoft.Imaging.ImageProcessing.Document.DocumentPerspectiveCorrectionCommand command =
new Vintasoft.Imaging.ImageProcessing.Document.DocumentPerspectiveCorrectionCommand();
// apply the perspective correction to a document image
command.ExecuteInPlace(image);
// save the result image to a file
image.Save(resultFile);
}
}
Inheritance Hierarchy
System.Object
 Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
   Vintasoft.Imaging.ImageProcessing.Document.DocumentPerspectiveCorrectionCommand
Requirements
Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
See Also