detectDocument method

DetectedDocument detectDocument(
  1. DocumentImage image,
  2. Rectangle detectionZone
)

Detects a document on a delimited area of the specified DocumentImage and returns a DetectedDocument. Important: Document templates must be loaded before calling this method.

param image Source image to process param detectionZone Crop in the image where to look for document. Default is the full image. Output corners are in the full image referential. return Detected document in the image throws DocumentException An error has occurred during Document Library execution.

Implementation

DetectedDocument detectDocument(DocumentImage image, Rectangle detectionZone) {
  DetectedDocument detectedDocument = DetectedDocument();
  var err = documentSDK.id3DocumentDetector_DetectDocument(_pHandle.value, image.handle, detectionZone.handle, detectedDocument.handle);
  if (err != DocumentError.success.value) {
    detectedDocument.dispose();
    throw DocumentException(err);
  }
  return detectedDocument;
}