Vision OCR API, gRPC: TextRecognitionService.Recognize
To send the image for text recognition.
gRPC request
rpc Recognize (RecognizeTextRequest) returns (stream RecognizeTextResponse)
RecognizeTextRequest
{
// Includes only one of the fields `content`
"content": "bytes",
// end of the list of possible fields
"mimeType": "string",
"languageCodes": [
"string"
],
"model": "string"
}
Field |
Description |
content |
bytes Bytes with data Includes only one of the fields |
mimeType |
string Specifications of the (MIME type
|
languageCodes[] |
string List of the languages to recognize text. |
model |
string Model to use for text detection. |
RecognizeTextResponse
{
"textAnnotation": {
"width": "int64",
"height": "int64",
"blocks": [
{
"boundingBox": {
"vertices": [
{
"x": "int64",
"y": "int64"
}
]
},
"lines": [
{
"boundingBox": {
"vertices": [
{
"x": "int64",
"y": "int64"
}
]
},
"text": "string",
"words": [
{
"boundingBox": {
"vertices": [
{
"x": "int64",
"y": "int64"
}
]
},
"text": "string",
"entityIndex": "int64",
"textSegments": [
{
"startIndex": "int64",
"length": "int64"
}
]
}
],
"textSegments": [
{
"startIndex": "int64",
"length": "int64"
}
],
"orientation": "Angle"
}
],
"languages": [
{
"languageCode": "string"
}
],
"textSegments": [
{
"startIndex": "int64",
"length": "int64"
}
]
}
],
"entities": [
{
"name": "string",
"text": "string"
}
],
"tables": [
{
"boundingBox": {
"vertices": [
{
"x": "int64",
"y": "int64"
}
]
},
"rowCount": "int64",
"columnCount": "int64",
"cells": [
{
"boundingBox": {
"vertices": [
{
"x": "int64",
"y": "int64"
}
]
},
"rowIndex": "int64",
"columnIndex": "int64",
"columnSpan": "int64",
"rowSpan": "int64",
"text": "string",
"textSegments": [
{
"startIndex": "int64",
"length": "int64"
}
]
}
]
}
],
"fullText": "string",
"rotate": "Angle"
},
"page": "int64"
}
Field |
Description |
textAnnotation |
Recognized text blocks in page or text from entities. |
page |
int64 Page number in PDF file. |
TextAnnotation
Field |
Description |
width |
int64 Page width in pixels. |
height |
int64 Page height in pixels. |
blocks[] |
Recognized text blocks in this page. |
entities[] |
Recognized entities. |
tables[] |
|
fullText |
string Full text recognized from image. |
rotate |
enum Angle Angle of image rotation.
|
Block
Field |
Description |
boundingBox |
Area on the page where the text block is located. |
lines[] |
Recognized lines in this block. |
languages[] |
A list of detected languages |
textSegments[] |
Block position from full_text string. |
Polygon
Field |
Description |
vertices[] |
The bounding polygon vertices. |
Vertex
Field |
Description |
x |
int64 X coordinate in pixels. |
y |
int64 Y coordinate in pixels. |
Line
Field |
Description |
boundingBox |
Area on the page where the line is located. |
text |
string Recognized text. |
words[] |
Recognized words. |
textSegments[] |
Line position from full_text string. |
orientation |
enum Angle Angle of line rotation.
|
Word
Field |
Description |
boundingBox |
Area on the page where the word is located. |
text |
string Recognized word value. |
entityIndex |
int64 ID of the recognized word in entities array. |
textSegments[] |
Word position from full_text string. |
TextSegments
Field |
Description |
startIndex |
int64 Start character position from full_text string. |
length |
int64 Text segment length. |
DetectedLanguage
Field |
Description |
languageCode |
string Detected language code. |
Entity
Field |
Description |
name |
string Entity name. |
text |
string Recognized entity text. |
Table
Field |
Description |
boundingBox |
Area on the page where the table is located. |
rowCount |
int64 Number of rows in table. |
columnCount |
int64 Number of columns in table. |
cells[] |
Table cells. |
TableCell
Field |
Description |
boundingBox |
Area on the page where the table cell is located. |
rowIndex |
int64 Row index. |
columnIndex |
int64 Column index. |
columnSpan |
int64 Column span. |
rowSpan |
int64 Row span. |
text |
string Text in cell. |
textSegments[] |
Table cell position from full_text string. |