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

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: int.

    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: int.

    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([{atom(), 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: int.

    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: int.

    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
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.t().

    Input image CV_8UC1 or CV_8UC3

  • min_confidence: int

Keyword Arguments
  • component_level: int.

    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(), [{atom(), 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
  • self: Evision.Text.OCRTesseract.t()
  • image: Evision.Mat.t()
  • mask: Evision.Mat.t()
  • min_confidence: int
Keyword Arguments
  • component_level: int.
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.t().

    Input image CV_8UC1 or CV_8UC3

  • min_confidence: int

Keyword Arguments
  • component_level: int.

    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(),
  [{atom(), term()}, ...] | nil
) :: binary() | {:error, String.t()}

run

Positional Arguments
  • self: Evision.Text.OCRTesseract.t()
  • image: Evision.Mat.t()
  • mask: Evision.Mat.t()
  • min_confidence: int
Keyword Arguments
  • component_level: int.
Return

Python prototype (for reference only):

run(image, mask, min_confidence[, component_level]) -> retval
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