forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Sheng, Lichang <lichangsheng1@noreply.gitea.eco.tsi-dev.otc-service.com> Co-committed-by: Sheng, Lichang <lichangsheng1@noreply.gitea.eco.tsi-dev.otc-service.com>
406 lines
36 KiB
HTML
406 lines
36 KiB
HTML
<a name="ocr_03_0042"></a><a name="ocr_03_0042"></a>
|
|
|
|
<h1 class="topictitle1">General Text</h1>
|
|
<div id="body0000001696801984"><div class="section" id="ocr_03_0042__section19654449133413"><h4 class="sectiontitle">Function</h4><p id="ocr_03_0042__p1085875063413">This API detects and extracts text from images and converts the text and coordinates into JSON format. It can be used in various scenarios, such as scanned documents, electronic documents, books, receipts, and forms.</p>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section19659149173410"><h4 class="sectiontitle">Constraints and Limitations</h4><ul id="ocr_03_0042__ul785914506344"><li id="ocr_03_0042__li16859150173412">Only images in PNG, JPG, JPEG, BMP, GIF, or TIFF format can be recognized.</li><li id="ocr_03_0042__li19859165011342">No side of the image can be smaller than 15 or larger than 8,192 pixels.</li><li id="ocr_03_0042__li2085919502343">The area to be recognized must occupy more than 80% of the image. When scanning a table, ensure that all text and its surrounding area are included in the image.</li><li id="ocr_03_0042__li1185925023417">An image can be rotated to any angle.</li><li id="ocr_03_0042__li138590503341">Text in images with complex backgrounds (such as outdoor scenery or anti-counterfeit watermarks) or distorted text cannot be recognized.</li><li id="ocr_03_0042__li4859175093414">Supported languages: Chinese, English, some traditional Chinese, Malay, Ukrainian, Hindi, Russian, Vietnamese, Indonesian, Thai, Arabic, German, Latin, French, Italian, Spanish, Portuguese, Romanian, Polish Amharic, Japanese, Korean, Turkish, Norwegian, Danish, and Swedish.</li></ul>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section1370104913413"><h4 class="sectiontitle">URI</h4><p id="ocr_03_0042__p14859150183415">POST /v2/{project_id}/ocr/general-text</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table67036492347" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameters</caption><thead align="left"><tr id="ocr_03_0042__row685985015342"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.3.2.4.1.1"><p id="ocr_03_0042__p11859950123412">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.3.2.4.1.2"><p id="ocr_03_0042__p19859125011346">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="60%" id="mcps1.3.3.3.2.4.1.3"><p id="ocr_03_0042__p18859950153413">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row88591350163418"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.4.1.1 "><p id="ocr_03_0042__p28594508345">endpoint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.4.1.2 "><p id="ocr_03_0042__p1985955011348">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.3.3.2.4.1.3 "><p id="ocr_03_0042__p5859135043411">Endpoint, which is the request address for calling an API.</p>
|
|
<p id="ocr_03_0042__p1385945020348">The endpoint varies depending on services in different regions. For more details, see <a href="ocr_03_0062.html">Endpoint</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row11859145013345"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.4.1.1 "><p id="ocr_03_0042__p78601350143414">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.4.1.2 "><p id="ocr_03_0042__p186075019346">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.3.3.2.4.1.3 "><p id="ocr_03_0042__p58601550163419">Project ID, which can be obtained by referring to <a href="ocr_03_0130.html">Obtaining the Project ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section97477491341"><h4 class="sectiontitle">Request Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table57501349103415" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="ocr_03_0042__row68601550183416"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.2.5.1.1"><p id="ocr_03_0042__p2860135017347">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.2.5.1.2"><p id="ocr_03_0042__p19860185093419">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.2.5.1.3"><p id="ocr_03_0042__p178601650103412">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.4.2.2.5.1.4"><p id="ocr_03_0042__p1886035020346">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row14860145033417"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.1 "><p id="ocr_03_0042__p2860155093416">X-Auth-Token</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.2 "><p id="ocr_03_0042__p16860185019343">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.3 "><p id="ocr_03_0042__p148601250173417">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.4.2.2.5.1.4 "><p id="ocr_03_0042__p0860205033416">User token.</p>
|
|
<p id="ocr_03_0042__p1860750163413">Used to obtain the permission to use APIs. The token is the value of <strong id="ocr_03_0042__b172785537278">X-Subject-Token</strong> in the response header in <a href="ocr_03_0005.html">Authentication</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row18601050183410"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.1 "><p id="ocr_03_0042__p1686025033420">Content-Type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.2 "><p id="ocr_03_0042__p1086019505349">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.2.5.1.3 "><p id="ocr_03_0042__p1786019508349">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.4.2.2.5.1.4 "><p id="ocr_03_0042__p178606504341">MIME type of the request body. The value is <strong id="ocr_03_0042__b285871632813">application/json</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table1892384943414" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Request body parameters</caption><thead align="left"><tr id="ocr_03_0042__row108611150153418"><th align="left" class="cellrowborder" valign="top" width="15.308469153084689%" id="mcps1.3.4.3.2.5.1.1"><p id="ocr_03_0042__p586115033416">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.32836716328367%" id="mcps1.3.4.3.2.5.1.2"><p id="ocr_03_0042__p118611050193414">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.268673132686729%" id="mcps1.3.4.3.2.5.1.3"><p id="ocr_03_0042__p19861125012342">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="55.0944905509449%" id="mcps1.3.4.3.2.5.1.4"><p id="ocr_03_0042__p108611501347">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row88611650133417"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p208611050193419">image</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p12861175033419">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p886255033410">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p128621550123419">Set either this parameter or <strong id="ocr_03_0042__b1032181617293">url</strong>.</p>
|
|
<p id="ocr_03_0042__p286220504349">Base64-encoded image file. The image file has a size limit of 10 MB.</p>
|
|
<p id="ocr_03_0042__p12862650173418">No side of the image can be smaller than 15 or larger than 8,192 pixels. Only images in JPEG, JPG, PNG, BMP, GIF, or TIFF format can be recognized.</p>
|
|
<p id="ocr_03_0042__p1186225015342">An example is <strong id="ocr_03_0042__b21278948507581">/9j/4AAQSkZJRgABAg...</strong>. If the image data contains an unnecessary prefix, the error "The image format is not supported" is reported.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row88621250123416"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p208626501342">url</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p2862165014341">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p10862350123414">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p4862650193416">Set either this parameter or <strong id="ocr_03_0042__b16840541667581">image</strong>. Image URL. Currently, the following URLs are supported:</p>
|
|
<ul id="ocr_03_0042__ul386211505341"><li id="ocr_03_0042__li28621250153414">Public HTTP/HTTPS URL</li><li id="ocr_03_0042__li1486214507345">URL provided by OBS.</li></ul>
|
|
<div class="note" id="ocr_03_0042__note1594105124215"><span class="notetitle"> NOTE: </span><div class="notebody"><ul id="ocr_03_0042__ul9597105418426"><li id="ocr_03_0042__li12597115414213">The API response time depends on the image download time. If the image download takes a long time, the API call will fail.</li><li id="ocr_03_0042__li14597105412421">Ensure that the storage service where the images to be detected reside is stable and reliable. OBS is recommended for storing image data.</li><li id="ocr_03_0042__li659735474218">The URL cannot contain Chinese characters. If Chinese characters exist, they must be encoded using UTF-8.</li></ul>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row68621250113418"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p138621350153417">detect_direction</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p3862450143414">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p168625504343">Boolean</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p086245017341">Whether to align the tilted image. The options are as follows:</p>
|
|
<ul id="ocr_03_0042__ul1786316501341"><li id="ocr_03_0042__li19863850133413"><strong id="ocr_03_0042__b3280455747581">true</strong>: The tilted image will be aligned.</li><li id="ocr_03_0042__li686395013411"><strong id="ocr_03_0042__b21125608487581">false</strong>: The tilted image will not be aligned.</li></ul>
|
|
<p id="ocr_03_0042__p786395012346">An image tilted to any angle can be aligned. If this parameter is not specified, <strong id="ocr_03_0042__b07321089337">false</strong> is used by default.</p>
|
|
<p id="ocr_03_0042__p1386318500347">If the image to be recognized is tilted, you are advised to set this parameter to <strong id="ocr_03_0042__b10321543311">true</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row2863450193417"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p386365014349">quick_mode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p10863155013413">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p1886335063410">Boolean</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p086365014342">Whether to enable the quick mode. For a single-line text image (the image contains only one line of text and the text area occupies more than 50% of the image), the recognition results can be returned more quickly when this quick mode is enabled. The options are as follows:</p>
|
|
<ul id="ocr_03_0042__ul13863105083411"><li id="ocr_03_0042__li13863250133420"><strong id="ocr_03_0042__b11763342677581">true</strong>: The quick mode will be enabled.</li><li id="ocr_03_0042__li6863165017342"><strong id="ocr_03_0042__b17913359457581">false</strong>: The quick mode will be disabled.</li></ul>
|
|
<p id="ocr_03_0042__p8863650133413">If this parameter is not specified, <strong id="ocr_03_0042__b8484573997581">false</strong> is used by default.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row15863195053410"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p118631050203415">character_mode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p6863205018344">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p12863125012349">Boolean</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p88631650123417">Whether to enable the single-character mode. The options are as follows:</p>
|
|
<ul id="ocr_03_0042__ul98631450103417"><li id="ocr_03_0042__li586345043414"><strong id="ocr_03_0042__b4264269217581">true</strong>: The single-character mode is enabled.</li><li id="ocr_03_0042__li7863145013412"><strong id="ocr_03_0042__b12810274397581">false</strong>: The single-character mode is disabled.</li></ul>
|
|
<p id="ocr_03_0042__p9863175015347">If this parameter is not transferred, the default value <strong id="ocr_03_0042__b159713615342">false</strong> is used, and information about a single character that occupies a text line is not returned.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row4864150123411"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p6864950163415">language</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p686475043413">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p1786419506342">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p108641650153414">Language. If this parameter is not specified, Chinese and English will be used by default. The options are as follows:</p>
|
|
<ul id="ocr_03_0042__ul1986495016344"><li id="ocr_03_0042__li1486410509349"><strong id="ocr_03_0042__b10258144657581">auto</strong>: automatic language classification</li><li id="ocr_03_0042__li10864195023415"><strong id="ocr_03_0042__b7357133317581">ms</strong>: Malay</li><li id="ocr_03_0042__li1286445083417"><strong id="ocr_03_0042__b19988043547581">uk</strong>: Ukrainian</li><li id="ocr_03_0042__li2864205020346"><strong id="ocr_03_0042__b4104808187581">hi</strong>: Hindi</li><li id="ocr_03_0042__li148641350203419"><strong id="ocr_03_0042__b18818987717581">ru</strong>: Russian</li><li id="ocr_03_0042__li7864125013420"><strong id="ocr_03_0042__b16337539167581">vi</strong>: Vietnamese</li><li id="ocr_03_0042__li108641250133419"><strong id="ocr_03_0042__b7680799647581">id</strong>: Indonesian</li><li id="ocr_03_0042__li18641450113420"><strong id="ocr_03_0042__b18527074197581">th</strong>: Thai</li><li id="ocr_03_0042__li2864145014344"><strong id="ocr_03_0042__b18829267547581">zh</strong>: Chinese and English</li><li id="ocr_03_0042__li11864195018344"><strong id="ocr_03_0042__b18922174677581">ar</strong>: Arabic</li><li id="ocr_03_0042__li586415017344"><strong id="ocr_03_0042__b12941179727581">de</strong>: German</li><li id="ocr_03_0042__li886414507341"><strong id="ocr_03_0042__b1937897827581">la</strong>: Latin</li><li id="ocr_03_0042__li58641350143418"><strong id="ocr_03_0042__b18697063487581">fr</strong>: French</li><li id="ocr_03_0042__li16864145010344"><strong id="ocr_03_0042__b21456063727581">it</strong>: Italian</li><li id="ocr_03_0042__li1986425016349"><strong id="ocr_03_0042__b3339480527581">es</strong>: Spanish</li><li id="ocr_03_0042__li2864205018344"><strong id="ocr_03_0042__b548223067581">pt</strong>: Portuguese</li><li id="ocr_03_0042__li88641250123410"><strong id="ocr_03_0042__b6136934517581">ro</strong>: Romanian</li><li id="ocr_03_0042__li78645501346"><strong id="ocr_03_0042__b14503051207581">pl</strong>: Polish</li><li id="ocr_03_0042__li11865750143414"><strong id="ocr_03_0042__b14046501537581">am</strong>: Amharic</li><li id="ocr_03_0042__li286565033419"><strong id="ocr_03_0042__b13251689587581">ja</strong>: Japanese</li><li id="ocr_03_0042__li18865750153412"><strong id="ocr_03_0042__b6962543117581">ko</strong>: Korean</li><li id="ocr_03_0042__li123001028311"><strong id="ocr_03_0042__b10682510267581">tr</strong>: Turkish</li><li id="ocr_03_0042__li5916176524"><strong id="ocr_03_0042__b2840835287581">no</strong>: Norwegian</li><li id="ocr_03_0042__li1651313311411"><strong id="ocr_03_0042__b9167636007581">da</strong>: Danish</li><li id="ocr_03_0042__li51351415312"><strong id="ocr_03_0042__b19162741097581">sv</strong>: Swedish</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row1786515016347"><td class="cellrowborder" valign="top" width="15.308469153084689%" headers="mcps1.3.4.3.2.5.1.1 "><p id="ocr_03_0042__p186565063411">single_orientation_mode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.32836716328367%" headers="mcps1.3.4.3.2.5.1.2 "><p id="ocr_03_0042__p68651750193416">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.268673132686729%" headers="mcps1.3.4.3.2.5.1.3 "><p id="ocr_03_0042__p5865950173412">Boolean</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="55.0944905509449%" headers="mcps1.3.4.3.2.5.1.4 "><p id="ocr_03_0042__p086515014346">Whether to enable the single direction mode. The options are as follows:</p>
|
|
<ul id="ocr_03_0042__ul13865195018340"><li id="ocr_03_0042__li586545019346"><strong id="ocr_03_0042__b12003197087581">true</strong>: The single direction mode is enabled.</li><li id="ocr_03_0042__li11865125043410"><strong id="ocr_03_0042__b3936395447581">false</strong>: The single direction mode is disabled.</li></ul>
|
|
<p id="ocr_03_0042__p48651750153410">If this parameter is not specified, <strong id="ocr_03_0042__b17713359797581">false</strong> is used by default. In this case, the fields in the image are recognized as in multiple directions by default.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section3164175003416"><h4 class="sectiontitle">Response Parameters</h4><div class="note" id="ocr_03_0042__note851821815431"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="ocr_03_0042__p19518191820436">The status code may vary depending on the recognition results. For example, <strong id="ocr_03_0042__b4350796797581">200</strong> indicates that the API is successfully called, and <strong id="ocr_03_0042__b11059566217581">400</strong> indicates that the API fails to be called. The following describes the status codes and corresponding response parameters.</p>
|
|
</div></div>
|
|
<p id="ocr_03_0042__p14865165083420"><strong id="ocr_03_0042__b20865550183413">Status code: 200</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table41729500343" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Response body parameter</caption><thead align="left"><tr id="ocr_03_0042__row986535010349"><th align="left" class="cellrowborder" valign="top" width="24.240000000000002%" id="mcps1.3.5.4.2.4.1.1"><p id="ocr_03_0042__p7865850193418">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.16%" id="mcps1.3.5.4.2.4.1.2"><p id="ocr_03_0042__p786555053413">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="59.599999999999994%" id="mcps1.3.5.4.2.4.1.3"><p id="ocr_03_0042__p1986575010348">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row138651350193419"><td class="cellrowborder" valign="top" width="24.240000000000002%" headers="mcps1.3.5.4.2.4.1.1 "><p id="ocr_03_0042__p686517502341">result</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.5.4.2.4.1.2 "><p id="ocr_03_0042__p4866175015341"><a href="#ocr_03_0042__table2201135023416">Table 5</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.5.4.2.4.1.3 "><p id="ocr_03_0042__p88661450153413">Recognition result</p>
|
|
<p id="ocr_03_0042__p1686695018345">This parameter is not returned when the API fails to be called.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="ocr_03_0042__table2201135023416"></a><a name="table2201135023416"></a><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table2201135023416" frame="border" border="1" rules="all"><caption><b>Table 5 </b>GeneralTextResult</caption><thead align="left"><tr id="ocr_03_0042__row17866205012345"><th align="left" class="cellrowborder" valign="top" width="24.240000000000002%" id="mcps1.3.5.5.2.4.1.1"><p id="ocr_03_0042__p20866165053418">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.16%" id="mcps1.3.5.5.2.4.1.2"><p id="ocr_03_0042__p08662508347">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="59.599999999999994%" id="mcps1.3.5.5.2.4.1.3"><p id="ocr_03_0042__p1186695003410">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row1086695043411"><td class="cellrowborder" valign="top" width="24.240000000000002%" headers="mcps1.3.5.5.2.4.1.1 "><p id="ocr_03_0042__p1786635010346">direction</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.5.5.2.4.1.2 "><p id="ocr_03_0042__p118661450133418">Float</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.5.5.2.4.1.3 "><p id="ocr_03_0042__p1586665017345">Image direction</p>
|
|
<ul id="ocr_03_0042__ul178661450123417"><li id="ocr_03_0042__li19866195013347">This parameter is available only when <strong id="ocr_03_0042__b17771130907581">detect_direction</strong> is set to <strong id="ocr_03_0042__b12204694847581">true</strong>. The anti-clockwise rotation angle of an image is returned. The value ranges from 0 to 359.</li><li id="ocr_03_0042__li4866135011345">When <strong id="ocr_03_0042__b16856226137581">detect_direction</strong> is set to <strong id="ocr_03_0042__b5828339307581">false</strong>, the value of this parameter is <strong id="ocr_03_0042__b8984383207581">-1</strong>.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row086613506347"><td class="cellrowborder" valign="top" width="24.240000000000002%" headers="mcps1.3.5.5.2.4.1.1 "><p id="ocr_03_0042__p68661450153419">words_block_count</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.5.5.2.4.1.2 "><p id="ocr_03_0042__p17866195013410">Integer</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.5.5.2.4.1.3 "><p id="ocr_03_0042__p1866450193419">Number of detected text blocks</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row986605016347"><td class="cellrowborder" valign="top" width="24.240000000000002%" headers="mcps1.3.5.5.2.4.1.1 "><p id="ocr_03_0042__p28664501349">words_block_list</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.5.5.2.4.1.2 "><p id="ocr_03_0042__p186610501347">Array of <a href="#ocr_03_0042__table122257509346">Table 6</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.5.5.2.4.1.3 "><p id="ocr_03_0042__p886612506341">List of recognized text blocks. The output sequence is from left to right and from top to bottom.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="ocr_03_0042__table122257509346"></a><a name="table122257509346"></a><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table122257509346" frame="border" border="1" rules="all"><caption><b>Table 6 </b>GeneralTextWordsBlockList</caption><thead align="left"><tr id="ocr_03_0042__row12867250153419"><th align="left" class="cellrowborder" valign="top" width="24.490000000000002%" id="mcps1.3.5.6.2.4.1.1"><p id="ocr_03_0042__p486775016345">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.33%" id="mcps1.3.5.6.2.4.1.2"><p id="ocr_03_0042__p10867135019349">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="59.18%" id="mcps1.3.5.6.2.4.1.3"><p id="ocr_03_0042__p15867850123419">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row148671050183416"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.6.2.4.1.1 "><p id="ocr_03_0042__p1286785073413">words</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.6.2.4.1.2 "><p id="ocr_03_0042__p98671450153418">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.6.2.4.1.3 "><p id="ocr_03_0042__p4867185033411">Recognition result of a text block</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row686765013349"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.6.2.4.1.1 "><p id="ocr_03_0042__p13867165043415">location</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.6.2.4.1.2 "><p id="ocr_03_0042__p1586785073413">Array<Array<Integer>></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.6.2.4.1.3 "><p id="ocr_03_0042__p68674505341">List of location information about a text block, including the 2D coordinates (x, y) of four vertexes in the text area, where the coordinate origin is the upper-left corner of the image, the X axis is horizontal, and the Y axis is vertical.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row58671050133411"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.6.2.4.1.1 "><p id="ocr_03_0042__p586725019346">confidence</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.6.2.4.1.2 "><p id="ocr_03_0042__p1486711507347">Float</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.6.2.4.1.3 "><p id="ocr_03_0042__p1686716509347">Confidence of a recognized text block</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row1186715017346"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.6.2.4.1.1 "><p id="ocr_03_0042__p68671508346">char_list</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.6.2.4.1.2 "><p id="ocr_03_0042__p2867250173410">Array of <a href="#ocr_03_0042__table152461450153416">Table 7</a></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.6.2.4.1.3 "><p id="ocr_03_0042__p128671250163415">Single-character recognition list corresponding to a text block. The output sequence is from left to right and from top to bottom.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="ocr_03_0042__table152461450153416"></a><a name="table152461450153416"></a><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table152461450153416" frame="border" border="1" rules="all"><caption><b>Table 7 </b>GeneralTextCharList</caption><thead align="left"><tr id="ocr_03_0042__row4868125017341"><th align="left" class="cellrowborder" valign="top" width="24.490000000000002%" id="mcps1.3.5.7.2.4.1.1"><p id="ocr_03_0042__p1486811501346">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.33%" id="mcps1.3.5.7.2.4.1.2"><p id="ocr_03_0042__p1886815506341">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="59.18%" id="mcps1.3.5.7.2.4.1.3"><p id="ocr_03_0042__p16868125033412">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row486818507341"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.7.2.4.1.1 "><p id="ocr_03_0042__p1686835012346">char</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.7.2.4.1.2 "><p id="ocr_03_0042__p18868350153418">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.7.2.4.1.3 "><p id="ocr_03_0042__p16871205019346">Recognition result of a single character</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row48715500348"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.7.2.4.1.1 "><p id="ocr_03_0042__p78711650193418">char_location</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.7.2.4.1.2 "><p id="ocr_03_0042__p1887185033417">Array<Array<Integer>></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.7.2.4.1.3 "><p id="ocr_03_0042__p1187118501349">List of location information about a single character, including the 2D coordinates (x, y) of four vertexes in the character area, where the coordinate origin is the upper-left corner of the image, the X axis is horizontal, and the Y axis is vertical.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row987115507346"><td class="cellrowborder" valign="top" width="24.490000000000002%" headers="mcps1.3.5.7.2.4.1.1 "><p id="ocr_03_0042__p1987175093417">char_confidence</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.33%" headers="mcps1.3.5.7.2.4.1.2 "><p id="ocr_03_0042__p48711150123411">Float</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.18%" headers="mcps1.3.5.7.2.4.1.3 "><p id="ocr_03_0042__p8871195093412">Confidence of a recognized character</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="ocr_03_0042__p08710507344"><strong id="ocr_03_0042__b208711650193411">Status code: 400</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table626219500347" frame="border" border="1" rules="all"><caption><b>Table 8 </b>Response body parameters</caption><thead align="left"><tr id="ocr_03_0042__row18871750163410"><th align="left" class="cellrowborder" valign="top" width="24.240000000000002%" id="mcps1.3.5.9.2.4.1.1"><p id="ocr_03_0042__p118711850183411">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.16%" id="mcps1.3.5.9.2.4.1.2"><p id="ocr_03_0042__p08712501344">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="59.599999999999994%" id="mcps1.3.5.9.2.4.1.3"><p id="ocr_03_0042__p6872250183415">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row887275019342"><td class="cellrowborder" valign="top" width="24.240000000000002%" headers="mcps1.3.5.9.2.4.1.1 "><p id="ocr_03_0042__p14872250153411">error_code</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.5.9.2.4.1.2 "><p id="ocr_03_0042__p2087205033416">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.5.9.2.4.1.3 "><p id="ocr_03_0042__p387205033418">Error code when calling the API failed</p>
|
|
<p id="ocr_03_0042__p1187285083416">This parameter is not returned when the API is successfully called.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row787265010349"><td class="cellrowborder" valign="top" width="24.240000000000002%" headers="mcps1.3.5.9.2.4.1.1 "><p id="ocr_03_0042__p1687285033414">error_msg</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.5.9.2.4.1.2 "><p id="ocr_03_0042__p158721350193416">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="59.599999999999994%" headers="mcps1.3.5.9.2.4.1.3 "><p id="ocr_03_0042__p1872650173414">Error message when the API call fails</p>
|
|
<p id="ocr_03_0042__p18721650183417">This parameter is not returned when the API is successfully called.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section162831050153418"><h4 class="sectiontitle">Example Request</h4><ul id="ocr_03_0042__ul28721350143417"><li id="ocr_03_0042__li1787217508343">Transfer the Base64 code of the image for recognition. During the recognition, the tilt angle of the image is not verified, and the quick mode is disabled.<pre class="screen" id="ocr_03_0042__screen1341437194517">POST https://{endpoint}/v2/{project_id}/ocr/general-text
|
|
Request Header:
|
|
Content-Type: application/json
|
|
X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
|
|
Request Body:
|
|
{
|
|
"image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAA...",
|
|
"detect_direction":false,
|
|
"quick_mode":false
|
|
}</pre>
|
|
</li><li id="ocr_03_0042__li187275073412">Transfer the URL of the image for recognition. During the recognition, the tilt angle of the image is not verified, and the quick mode is disabled.<pre class="screen" id="ocr_03_0042__screen991185184514">POST https://{endpoint}/v2/{project_id}/ocr/general-text
|
|
Request Header:
|
|
Content-Type: application/json
|
|
X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
|
|
Request Body:
|
|
{
|
|
"url":"https://BucketName.obs.xxxx.com/ObjectName",
|
|
"detect_direction":false,
|
|
"quick_mode":false
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section133081450173418"><h4 class="sectiontitle">Example Response</h4><p id="ocr_03_0042__p1387315073413"><strong id="ocr_03_0042__b2873165015347">Status code: 200</strong></p>
|
|
<p id="ocr_03_0042__p10873550183410">Example response for a successful request</p>
|
|
<pre class="screen" id="ocr_03_0042__screen1873185013413">{
|
|
"result" : {
|
|
"direction" : 67.6506,
|
|
"words_block_count" : 1,
|
|
"words_block_list" : [ {
|
|
"words": "<em id="ocr_03_0042__i19614103687581">Word</em>",
|
|
"confidence" : 0.9999,
|
|
"location" : [ [ 517, 447 ], [ 540, 504 ], [ 505, 518 ], [ 482, 461 ] ],
|
|
"char_list" : [ {
|
|
"char": "<em id="ocr_03_0042__i9560226097581">Character</em>",
|
|
"char_location" : [ [ 517, 447 ], [ 530, 479 ], [ 495, 493 ], [ 482, 461 ] ],
|
|
"char_confidence" : 0.9999
|
|
}, {
|
|
"char": "<em id="ocr_03_0042__i8365684137581">Character</em>",
|
|
"char_location" : [ [ 530, 479 ], [ 540, 504 ], [ 505, 518 ], [ 495, 493 ] ],
|
|
"char_confidence" : 0.9999
|
|
} ]
|
|
} ]
|
|
}
|
|
}</pre>
|
|
<p id="ocr_03_0042__p587413509342"><strong id="ocr_03_0042__b587495011343">Status code: 400</strong></p>
|
|
<p id="ocr_03_0042__p687445015349">Example response for a failed request</p>
|
|
<pre class="screen" id="ocr_03_0042__screen187414509349">{
|
|
"error_code": "AIS.0103",
|
|
"error_msg": "The image size does not meet the requirements."
|
|
}</pre>
|
|
</div>
|
|
<div class="section" id="ocr_03_0042__section3354135018340"><h4 class="sectiontitle">Status Codes</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ocr_03_0042__table183561250183411" frame="border" border="1" rules="all"><thead align="left"><tr id="ocr_03_0042__row1874105015349"><th align="left" class="cellrowborder" valign="top" width="30.3%" id="mcps1.3.8.2.1.3.1.1"><p id="ocr_03_0042__p11874105017348">Status Code</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="69.69999999999999%" id="mcps1.3.8.2.1.3.1.2"><p id="ocr_03_0042__p4874105063418">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="ocr_03_0042__row1987495083417"><td class="cellrowborder" valign="top" width="30.3%" headers="mcps1.3.8.2.1.3.1.1 "><p id="ocr_03_0042__p1787405017346">200</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.69999999999999%" headers="mcps1.3.8.2.1.3.1.2 "><p id="ocr_03_0042__p1687465015342">Response for a successful request</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="ocr_03_0042__row1874750123418"><td class="cellrowborder" valign="top" width="30.3%" headers="mcps1.3.8.2.1.3.1.1 "><p id="ocr_03_0042__p1487435013348">400</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.69999999999999%" headers="mcps1.3.8.2.1.3.1.2 "><p id="ocr_03_0042__p68741950113418">Response for a failed request</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p id="ocr_03_0042__p17678114169">See <a href="ocr_03_0090.html">Status Codes</a>.</p>
|
|
<div class="section" id="ocr_03_0042__section6683181041618"><h4 class="sectiontitle">Error Codes</h4><p id="ocr_03_0042__p1167161113163">See <a href="ocr_03_0028.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="ocr_03_0014.html">API</a></div>
|
|
</div>
|
|
</div>
|
|
|