Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# DocumentDetector.alignDocument Method

Module: DocumentDetector

## Definition

Aligns and crops the specified document on the specified image and returns a new DocumentImage.

Python

    align_document(self, source_image: DocumentImage, detected_document: DetectedDocument) -> DocumentImage

Parameters

> `source_image` DocumentImage
> in The source image containing the document.
> `detected_document` DetectedDocument
> in The detected document in the image.

Returns

> DocumentImage
> Realigned and cropped image of the document.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

Dart

    DocumentImage alignDocument(DocumentImage sourceImage, DetectedDocument detectedDocument)

Parameters

> `sourceImage` DocumentImage
> in The source image containing the document.
> `detectedDocument` DetectedDocument
> in The detected document in the image.

Returns

> DocumentImage
> Realigned and cropped image of the document.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

C#

    public DocumentImage AlignDocument(DocumentImage sourceImage, DetectedDocument detectedDocument)

Parameters

> `sourceImage` DocumentImage
> in The source image containing the document.
> `detectedDocument` DetectedDocument
> in The detected document in the image.

Returns

> DocumentImage
> Realigned and cropped image of the document.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

Java

    public DocumentImage alignDocument(DocumentImage sourceImage, DetectedDocument detectedDocument) throws DocumentException

Parameters

> `sourceImage` DocumentImage
> in The source image containing the document.
> `detectedDocument` DetectedDocument
> in The detected document in the image.

Returns

> DocumentImage
> Realigned and cropped image of the document.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

Swift

    public func alignDocument(sourceImage: DocumentImage, detectedDocument: DetectedDocument) throws -> DocumentImage

Parameters

> `sourceImage` DocumentImage
> in The source image containing the document.
> `detectedDocument` DetectedDocument
> in The detected document in the image.

Returns

> DocumentImage
> Realigned and cropped image of the document.

Exceptions

> DocumentException
> An error has occurred during Document Library execution.

C

    int id3DocumentDetector_AlignDocument (
        ID3_DOCUMENT_DETECTOR hDocumentDetector,
        ID3_DOCUMENT_IMAGE hSourceImage,
        ID3_DETECTED_DOCUMENT hDetectedDocument,
        ID3_DOCUMENT_IMAGE hAlignedImage)

Parameters

> `hDocumentDetector` ID3_DOCUMENT_DETECTOR
> in Handle to the DocumentDetector object.
> `hSourceImage` ID3_DOCUMENT_IMAGE
> in The source image containing the document.
> `hDetectedDocument` ID3_DETECTED_DOCUMENT
> in The detected document in the image.
> `hAlignedImage` ID3_DOCUMENT_IMAGE
> out Realigned and cropped image of the document.

Returns

> `int`
> An error code.
> See id3DocumentError file for the list of possible error codes.