History
Introduction
API Category
Making API Requests
Region APIs
Instance APIs
Cloud Hosting Cluster APIs
Image APIs
Instance Launch Template APIs
Placement Group APIs
Key APIs
Security Group APIs
Network APIs
Data Types
Error Codes
Domain name for API request: ocr.intl.tencentcloudapi.com.
This API is used to detect and recognize characters in an image. It can recognize Chinese, English, Chinese-English, digits, and special symbols and return the text box positions and characters.
It is suitable for scenarios with a lot of characters in complex layouts and requiring high recognition accuracy, such as examination papers, online images, signboards, and legal documents.
Strengths: compared with general print recognition, it provides higher-precision character recognition services. Its accuracy and recall rate are higher in difficult scenarios such as a large number of characters, long strings of digits, small characters, blurry characters, and tilted text.
This API is not fully available for the time being. For more information, please contact your Tencent Cloud sales rep.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: GeneralAccurateOCR. |
| Version | Yes | String | Common Params. The value used for this API: 2018-11-19. |
| Region | No | String | Common Params. This parameter is not required. |
| ImageBase64 | No | String | The Base64 value of the image/PDF. The image size after Base64 encoding must be no more than 10M, with a resolution of 600*800 or higher recommended. PNG, JPG, JPEG, BMP, and PDF formats are supported. Either ImageUrl or ImageBase64 of the image must be provided. If both are provided, only ImageUrl will be used. |
| ImageUrl | No | String | URL address of image. The image cannot exceed 10 MB after being Base64-encoded. A resolution above 600x800 is recommended. PNG, JPG, JPEG, and BMP formats are supported. We recommend you store the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability. The download speed and stability of non-Tencent Cloud URLs may be low. |
| EnableDetectSplit | No | Boolean | Whether to enable original image slicing detection. Once enabled, it improves recognition accuracy in scenarios where "the overall image area is large but the single character occupies a small proportion" (for example: exam paper). Default: disabled. Note: Only supported when ConfigID is configured as OCR. |
| IsPdf | No | Boolean | Whether PDF recognition is enabled. The default value is false. Once enabled, it can simultaneously support image and PDF recognition. |
| PdfPageNumber | No | Integer | The corresponding page number of the PDF page to be recognized. Only single page recognition is supported. Valid at that time when the upload file is a PDF and the IsPdf parameter value is true. The default value is 1. |
| EnableDetectText | No | Boolean | Text Detection Switch, true by default. Set to false to directly perform single-line recognition, suitable for image scenarios containing only forward single-line text. |
| ConfigID | No | String | Configuration ID support: OCR -- common scenarios MulOCR -- multilingual scenario. Default value: OCR. |
| Parameter Name | Type | Description |
|---|---|---|
| TextDetections | Array of TextDetection | Detected text information, including row content, confidence degree, text line coordinate, and rotation corrected coordinate. For specific content, please click the left-side link. |
| Angle | Float | Image rotation angle (angle system), the text's horizontal direction is Zero degrees; clockwise is positive, counterclockwise is negative. Click to view How to correct tilt text |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Detect and recognize text in the overall image, return text box position and text. Go to DevTools
POST / HTTP/1.1
Host: ocr.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: GeneralAccurateOCR
<Common request parameters>
{
"ImageUrl": "https://ocr-demo-1254418846.cos.ap-guangzhou.myqcloud.com/general/GeneralAccurateOCR/GeneralAccurateOCR1.jpg"
}
{
"Response": {
"Angle": 359.989990234375,
"RequestId": "4021987a-5441-4160-981a-d084cd96b5ad",
"TextDetections": [
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":1}}",
"Confidence": 100,
"DetectedText": "Intermittent Fasting: The Slim Revolution Sweeping Worldwide"
"ItemPolygon": {
"Height": 26,
"Width": 264,
"X": 446,
"Y": 93
},
"Polygon": [
{
"X": 446,
"Y": 93
},
{
"X": 709,
"Y": 94
},
{
"X": 708,
"Y": 118
},
{
"X": 446,
"Y": 116
}
],
"WordCoordPoint": [],
"Words": []
},
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":2}}",
"Confidence": 100,
"DetectedText": "Special report."
"ItemPolygon": {
"Height": 30,
"Width": 103,
"X": 47,
"Y": 198
},
"Polygon": [
{
"X": 47,
"Y": 201
},
{
"X": 148,
"Y": 198
},
{
"X": 149,
"Y": 225
},
{
"X": 48,
"Y": 227
}
],
"WordCoordPoint": [],
"Words": []
},
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":3}}",
"Confidence": 100,
"DetectedText": "In 2009, I wrote "101 Things to Do Before Losing Weight" (101Things to Do",
"ItemPolygon": {
"Height": 34,
"Width": 629,
"X": 88,
"Y": 243
},
"Polygon": [
{
"X": 88,
"Y": 243
},
{
"X": 716,
"Y": 246
},
{
"X": 716,
"Y": 276
},
{
"X": 88,
"Y": 273
}
],
"WordCoordPoint": [],
"Words": []
},
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":3}}",
"Confidence": 100,
"DetectedText": "BeforeYou Diet), summarize my discouraging experience attempting various popular weight loss methods, each approach"
"ItemPolygon": {
"Height": 31,
"Width": 675,
"X": 43,
"Y": 290
},
"Polygon": [
{
"X": 43,
"Y": 292
},
{
"X": 717,
"Y": 290
},
{
"X": 717,
"Y": 318
},
{
"X": 43,
"Y": 320
}
],
"WordCoordPoint": [],
"Words": []
},
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":3}}",
"Confidence": 100,
"DetectedText": "All methods seem doomed to fail."
"ItemPolygon": {
"Height": 30,
"Width": 194,
"X": 44,
"Y": 338
},
"Polygon": [
{
"X": 44,
"Y": 340
},
{
"X": 237,
"Y": 338
},
{
"X": 237,
"Y": 365
},
{
"X": 44,
"Y": 367
}
],
"WordCoordPoint": [],
"Words": []
},
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":4}}",
"Confidence": 100,
"DetectedText": "In the past two decades of weight loss methods I've been exposed to, only intermittent fasting has helped me slim down"
"ItemPolygon": {
"Height": 30,
"Width": 635,
"X": 87,
"Y": 382
},
"Polygon": [
{
"X": 87,
"Y": 384
},
{
"X": 721,
"Y": 382
},
{
"X": 721,
"Y": 409
},
{
"X": 87,
"Y": 411
}
],
"WordCoordPoint": [],
"Words": []
},
{
"AdvancedInfo": "{\"Parag\":{\"ParagNo\":4}}",
"Confidence": 100,
"DetectedText": "No rebound afterward. As for the health benefits of anti-aging, they come effortlessly."
"ItemPolygon": {
"Height": 31,
"Width": 582,
"X": 41,
"Y": 430
},
"Polygon": [
{
"X": 41,
"Y": 432
},
{
"X": 622,
"Y": 430
},
{
"X": 622,
"Y": 457
},
{
"X": 41,
"Y": 460
}
],
"WordCoordPoint": [],
"Words": []
}
]
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation.DownLoadError | File download failed. |
| FailedOperation.EmptyImageError | The image is empty. |
| FailedOperation.EngineRecognizeTimeout | Recognition by the engine timed out. |
| FailedOperation.ImageBlur | The image is blurry. |
| FailedOperation.ImageDecodeFailed | Image decoding failed. |
| FailedOperation.ImageNoText | No text is detected in the image. |
| FailedOperation.ImageSizeTooLarge | The image size is too large. refer to the image size limit in the reference input. |
| FailedOperation.OcrFailed | OCR failed. This error may be caused by unstable network connections,service anomalies or other issues. |
| FailedOperation.UnKnowError | Unknown error. |
| FailedOperation.UnOpenError | The service is not activated. |
| InvalidParameter.EngineImageDecodeFailed | Image decoding failed. |
| InvalidParameterValue.InvalidParameterValueLimit | Incorrect parameter value. |
| LimitExceeded.TooLargeFileError | The file is too large. |
| ResourceUnavailable.InArrears | The account is in arrears. |
| ResourceUnavailable.ResourcePackageRunOut | The account resource package is exhausted. |
| ResourcesSoldOut.ChargeStatusException | Exceptional billing status. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan