alignDocument method

DocumentImage alignDocument(
  1. DocumentImage sourceImage,
  2. DetectedDocument detectedDocument
)

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

param sourceImage The source image containing the document. param detectedDocument The detected document in the image. return Realigned and cropped image of the document. throws DocumentException An error has occurred during Document Library execution.

Implementation

DocumentImage alignDocument(DocumentImage sourceImage, DetectedDocument detectedDocument) {
  DocumentImage alignedImage = DocumentImage();
  var err = documentSDK.id3DocumentDetector_AlignDocument(_pHandle.value, sourceImage.handle, detectedDocument.handle, alignedImage.handle);
  if (err != DocumentError.success.value) {
    alignedImage.dispose();
    throw DocumentException(err);
  }
  return alignedImage;
}