machinevisiontoolbox.Image.ocr

Image.ocr(minconf=50, plot=False)

Optical character recognition

Parameters:
  • minconf (int, optional) – minimum confidence value for text to be returned or plotted (percentage), defaults to 50

  • plot (bool, optional) – overlay detected text on the current plot, assumed to be the image, defaults to False

Returns:

detected strings and metadata

Return type:

list of OCRWord

Example:


Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.20/x64/lib/python3.9/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
TypeError: 'NoneType' object is not iterable

Each recognized text string is described by an OCRWord instance that contains the string, confidence and bounding box within the image.

Warning

PyTessearct must be installed.

References:
  • Robotics, Vision & Control for Python, Section 12.4.1, P. Corke, Springer 2023.

Seealso:

OCRWord