libs.services

Cloud OCR adapters and the dispatcher that extract_logsheet() uses via formhtr.libs.services.call_services.

formhtr.libs.services.call_services.call_services(logsheet_image, credentials, config)[source]

Run enabled OCR backends on one rasterized page.

Parameters:
  • logsheet_imagenumpy image array (RGB/BGR) of the aligned page.

  • credentials – Dict with keys google, amazon, azure. Values are a path string (Google), a credential dict (Amazon/Azure), or falsy to skip.

  • config – Object with width and height (page size) for Amazon box scaling.

Returns:

Dict with keys google, amazon, azure. Each value is a list of Rectangle instances, or None if that provider was not used or returned nothing.

formhtr.libs.services.utils.extract_corners(points)[source]

Identify bounding box for given polygon

Parameters:

points (list) – list of coordinates

Returns:

top-left and bottom-right coordinates

Return type:

list