View Source Evision.Text.OCRTesseract (Evision v0.2.9)

Summary

Types

t()

Type that represents an Text.OCRTesseract struct.

Functions

Creates an instance of the OCRTesseract class. Initializes Tesseract.

Creates an instance of the OCRTesseract class. Initializes Tesseract.

Recognize text using the tesseract-ocr API.

Types

@type t() :: %Evision.Text.OCRTesseract{ref: reference()}

Type that represents an Text.OCRTesseract struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec create() :: t() | {:error, String.t()}

Creates an instance of the OCRTesseract class. Initializes Tesseract.

Keyword Arguments
  • datapath: c_string.

    the name of the parent directory of tessdata ended with "/", or NULL to use the system's default directory.

  • language: c_string.

    an ISO 639-3 code or NULL will default to "eng".

  • char_whitelist: c_string.

    specifies the list of characters used for recognition. NULL defaults to "" (All characters will be used for recognition).

  • oem: integer().

    tesseract-ocr offers different OCR Engine Modes (OEM), by default tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible values.

  • psmode: integer().

    tesseract-ocr offers different Page Segmentation Modes (PSM) tesseract::PSM_AUTO (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other possible values.

Return
  • retval: OCRTesseract

Note: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".

Python prototype (for reference only):

create([, datapath[, language[, char_whitelist[, oem[, psmode]]]]]) -> retval
@spec create(Keyword.t()) :: any() | {:error, String.t()}
@spec create(
  [
    char_whitelist: term(),
    datapath: term(),
    language: term(),
    oem: term(),
    psmode: term()
  ]
  | nil
) :: t() | {:error, String.t()}

Creates an instance of the OCRTesseract class. Initializes Tesseract.

Keyword Arguments
  • datapath: c_string.

    the name of the parent directory of tessdata ended with "/", or NULL to use the system's default directory.

  • language: c_string.

    an ISO 639-3 code or NULL will default to "eng".

  • char_whitelist: c_string.

    specifies the list of characters used for recognition. NULL defaults to "" (All characters will be used for recognition).

  • oem: integer().

    tesseract-ocr offers different OCR Engine Modes (OEM), by default tesseract::OEM_DEFAULT is used. See the tesseract-ocr API documentation for other possible values.

  • psmode: integer().

    tesseract-ocr offers different Page Segmentation Modes (PSM) tesseract::PSM_AUTO (fully automatic layout analysis) is used. See the tesseract-ocr API documentation for other possible values.

Return
  • retval: OCRTesseract

Note: The char_whitelist default is changed after OpenCV 4.7.0/3.19.0 from "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" to "".

Python prototype (for reference only):

create([, datapath[, language[, char_whitelist[, oem[, psmode]]]]]) -> retval
@spec run(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

run(self, image, min_confidence)

View Source
@spec run(t(), Evision.Mat.maybe_mat_in(), integer()) ::
  binary() | {:error, String.t()}

Recognize text using the tesseract-ocr API.

Positional Arguments
  • self: Evision.Text.OCRTesseract.t()

  • image: Evision.Mat.

    Input image CV_8UC1 or CV_8UC3

  • min_confidence: integer()

Keyword Arguments
  • component_level: integer().

    OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXTLINE.

Return

Takes image on input and returns recognized text in the output_text parameter. Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values.

Python prototype (for reference only):

run(image, min_confidence[, component_level]) -> retval
Link to this function

run(self, image, min_confidence, opts)

View Source
@spec run(
  t(),
  Evision.Mat.maybe_mat_in(),
  integer(),
  [{:component_level, term()}] | nil
) ::
  binary() | {:error, String.t()}
@spec run(t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer()) ::
  binary() | {:error, String.t()}

Variant 1:

run

Positional Arguments
Keyword Arguments
  • component_level: integer().
Return

Python prototype (for reference only):

run(image, mask, min_confidence[, component_level]) -> retval

Variant 2:

Recognize text using the tesseract-ocr API.

Positional Arguments
  • self: Evision.Text.OCRTesseract.t()

  • image: Evision.Mat.

    Input image CV_8UC1 or CV_8UC3

  • min_confidence: integer()

Keyword Arguments
  • component_level: integer().

    OCR_LEVEL_WORD (by default), or OCR_LEVEL_TEXTLINE.

Return

Takes image on input and returns recognized text in the output_text parameter. Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values.

Python prototype (for reference only):

run(image, min_confidence[, component_level]) -> retval
Link to this function

run(self, image, mask, min_confidence, opts)

View Source
@spec run(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  integer(),
  [{:component_level, term()}] | nil
) :: binary() | {:error, String.t()}

run

Positional Arguments
Keyword Arguments
  • component_level: integer().
Return

Python prototype (for reference only):

run(image, mask, min_confidence[, component_level]) -> retval
Link to this function

setWhiteList(named_args)

View Source
@spec setWhiteList(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setWhiteList(self, char_whitelist)

View Source
@spec setWhiteList(t(), binary()) :: t() | {:error, String.t()}

setWhiteList

Positional Arguments
  • self: Evision.Text.OCRTesseract.t()
  • char_whitelist: String

Python prototype (for reference only):

setWhiteList(char_whitelist) -> None