VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.ImageProcessing.Document Namespace / DocumentPerspectiveCorrectionCommand Class
    Класс DocumentPerspectiveCorrectionCommand
    В этом разделе
    Исправляет искажение перспективы в изображении документа, удаляет границу в изображении документа и выравнивает изображение документа.
    Объектная модель
    ProcessingCommandResults DocumentPerspectiveCorrectionCommand
    Синтаксис
    'Declaration
    
    Public Class DocumentPerspectiveCorrectionCommand
       Inherits Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
    
    
    public class DocumentPerspectiveCorrectionCommand : Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
    
    
    public __gc class DocumentPerspectiveCorrectionCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase*
    
    
    public ref class DocumentPerspectiveCorrectionCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase^
    
    
    Ремарки

    Эта команда обработки изображений должна использоваться для обработки изображения, содержащего документ с видимыми границами.
    Если изображение документа захвачено с помощью камеры, команда может исправить искажение перспективы в изображении документа, удалить границу в изображении документа и выравнивать изображение документа.
    Если изображение документа получено со сканера изображений, команда может удалить границу в изображении документа и выравнивать изображение документа.

    Пример

    Вот C#/VB.NET код, который демонстрирует, как загрузить изображение с диска, исправить искажение перспективы в изображении документа и сохранить результат в новом файле изображения.

    
    ''' <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);
        }
    }
    
    

    Иерархия наследования

    System.Object
       Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
          Vintasoft.Imaging.ImageProcessing.Document.DocumentPerspectiveCorrectionCommand

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также