copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2019-06-04 |
Text recognition,Visual Recognition beta Text model,Text model,recognize text |
visual-recognition |
{:shortdesc: .shortdesc} {:external: target="_blank" .external} {:tip: .tip} {:important: .important} {:pre: .pre} {:codeblock: .codeblock} {:screen: .screen} {:apikey: data-credential-placeholder='apikey'} {:url: data-credential-placeholder='url'}
{: #tutorial-recognize-text}
This tutorial guides you through how to make your first call with the {{site.data.keyword.visualrecognitionshort}} beta Text model to detect and recognize English text in an image. {: shortdesc}
The Text model is a private beta feature, and you must have permission from {{site.data.keyword.IBM_notm}} to make calls to the model. Request access{: external}. For more information about beta features, see Release notes. {: important}
{: #tutorial-recognize-text-prerequisites}
- Go to the {{site.data.keyword.visualrecognitionshort}}{: external} page in the {{site.data.keyword.Bluemix_notm}} Catalog.
- Sign up for a free {{site.data.keyword.Bluemix_notm}} account or log in.
- Click Create.
- Copy the credentials to authenticate to your service instance:
- Click Show to view your credentials.
- Copy the API key value.
{: #tutorial-recognize-text-recognize-text}
-
Issue the following call to recognize text in an image{: external}. Replace
{your_api_key}
with the API key value that you copied earlier.curl -u "apikey:{your_api_key}"{: apikey} \ "https://gateway.watsonplatform.net/visual-recognition/api/v3/recognize_text?url=https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/lookButDontTouch.jpg&version=2018-03-19"
{: pre}
The response includes the recognized text and the locations of words in the text with a confidence score for each word. The location information can be used to draw bounding boxes around the words.
{ "images": [ { "image": "lookButDontTouch.jpg", "text": "look but\ndont\ntouch", "words": [ { "word": "look", "location": { "height": 651, "width": 1235, "left": 914, "top": 1591 }, "score": 0.9718, "line_number": 0 }, { "word": "but", "location": { "height": 651, "width": 939, "left": 2148, "top": 1591 }, "score": 0.9246, "line_number": 0 }, { "word": "dont", "location": { "height": 586, "width": 1594, "left": 1220, "top": 2240 }, "score": 0.5823, "line_number": 1 }, { "word": "touch", "location": { "height": 629, "width": 1701, "left": 1193, "top": 2824 }, "score": 0.8806, "line_number": 2 } ] } ], "images_processed": 1 }
{: codeblock}
{: #tutorial-recognize-text-next-steps}
You have a basic understanding of how to recognize text in an image. Explore further.
- Read the overview.
- Explore the Text model methods in the API reference{: external}.
{: #tutorial-recognize-text-attributions}
- lookButDontTouch{: external} by Lubo Minar{: external} on Unsplash{: external}. No changes were made to this image.