recognizes text in image and returns it as a string.


returns a list of strings at the specified structural level.


returns prop for text at the given level.

Details and Options

  • TextRecognize works with arbitrary grayscale and multichannel images, operating on the intensity value of each pixel.
  • TextRecognize[{image1,image2,}] returns recognition for all imagei.
  • By default, the recognized text is returned as a single string for the whole image. Recognized text can be split into levels.
  • Structural elements specified in level include:
  • Automatic text found in the whole image as a single string (default)
    "Block"a list of results for each block of text
    "Line"a list of results for each line
    "Word"a list of results for each word
    "Character"a list of results for each character
  • TextRecognize[image,level,prop] computes prop at the given level and returns the result as a list {val1,val2,}.
  • Possible settings for prop include:
  • "Text"recognized text (default)
    "BoundingBox"bounding box around the text as a Rectangle
    "Strength"strength of the recognized text
    "Image"cropped image containing the recognized text
    {prop1,prop2,}a list of properties
  • The following options can be specified:
  • Language$Languagethe language to recognize
    MaskingAllthe region of interest that includes text
    RecognitionPriorAutomaticassumption about text in each masked area
  • TextRecognize accepts a Language option. By default, Language:>$Language is used. Using Language->{lang1,lang2,} can be used to perform multi-language recognition.
  • The following Language settings can be used:
  • By default, the text found anywhere in the image is returned. Use Masking to specify the region of interest. Possible settings include:
  • Allall of the image
    Automaticautomatic text detection
    maska single region of interest
    {mask1,mask2,}multiple regions of interest
  • RecognitionPrior makes an assumption about the kind of text present in the whole image or in each masked area. Possible settings include:
  • Automaticautomatic structure recognition (default)
    "Column"a single column of text
    "Line"a single line of text
    "Word"a single word
    "Character"a single character
    "SparseText"text in no particular structure
  • TextRecognize uses machine learning, and its training set and methods may change in different versions of the Wolfram Language, yielding different results.


open all close all

Basic Examples  (2)

Recognize text in an image:

Click for copyable input

Recognize lines of text and their corresponding bounding boxes:

Click for copyable input
Click for copyable input

Highlight the bounding box of each recognized line:

Click for copyable input

Scope  (14)

Options  (8)

Applications  (6)

Properties & Relations  (2)

Possible Issues  (8)

Neat Examples  (1)

Introduced in 2010
Updated in 2019