tencent cloud

文字识别

购买指南
计费概述
欠费说明
错误码计费说明
快速入门
操作指引
快速接入指引
服务端 API 文档
History
Introduction
API Category
调用方式
Document Intelligent APIs
Card and Document OCR APIs
General Text OCR APIs
Vehicle Scene OCR APIs
Data Types
Error Codes
服务协议
Service Level Agreement
OCR Policy
隐私协议
数据处理和安全协议

GeneralAccurateOCR

PDF
聚焦模式
字号
最后更新时间: 2026-03-19 15:52:08

1. API Description

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.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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.

3. Output Parameters

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.

4. Example

Example1 GeneralAccurateOCR Call

Detect and recognize text in the overall image, return text box position and text. Go to DevTools

Input Example

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"
}

Output Example

{
    "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": []
            }
        ]
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

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.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈