General Text Recognition (OCR)
Updated at:2025-11-03
Function description
The user sends a request for the service to recognize all characters within an image.
Request parameters
| Parameters | Required or not | Types | Option range | Description |
|---|---|---|---|---|
| language_type | No | string | CHN_ENG、ENG、POR、FRE、GER、ITA、SPA、RUS、JAP、KOR | Recognition language type, defaulting to CHN_ENG. Optional values include: - CHN_ENG: Chinese-English mixed; - ENG: English; - POR: Portuguese; - FRE: French; - GER: German; - ITA: Italian; - SPA: Spanish; - RUS: Russian; - JAP: Japanese; - KOR: Korean |
| detect_direction | No | boolean | true、false | Whether to detect image orientation, defaulting to no detection, i.e., false. Orientation refers to whether the input image is in normal orientation or rotated counterclockwise by 90/180/270 degrees. Optional values include: - true: detect orientation; - false: do not detect orientation. |
| detect_language | No | string | true、false | Specifies whether language detection is required, with no detection set as the default. Currently supports Chinese, English, Japanese, and Korean. |
| probability | No | string | true、false | Whether to return the confidence level for each row in the recognition results |
Response parameters
| Field | Required or not | Types | Description |
|---|---|---|---|
| direction | No | int32 | Image orientation, present when detect_direction=true. - -1: Undefined, - 0: Positive, - 1: Rotate 90 degrees counterclockwise, - 2: Rotate 180 degrees counterclockwise, - 3: Rotate 270 degrees counterclockwise |
| log_id | Yes | uint64 | A unique log ID for issue localization |
| words_result | Yes | array() | Recognition result array |
| words_result_num | Yes | uint32 | Number of recognition results, indicating the number of elements in words_result |
| +words | No | string | Recognition result string |
| probability | No | object | Confidence value for each row in the recognition result, including average: average row confidence, variance: row confidence variance, min: minimum row confidence |
Response example
Plain Text
1{
2"log_id": 2471272194,
3"words_result_num": 2,
4"words_result":
5 [
6 {"words": " TSINGTAO"},
7 {"words": "Tsingtao Beer"}
8 ]
9}
