OCR文字识别

简介

HI,您好,欢迎使用学而思网校AI开放平台OCR文字识别接口服务。

本文档主要针对需要集成HTTP API的技术研发工程师,详细描述OCR文字识别能力相关的技术内容。您可以通过

接口能力

接口名称

接口能力简要描述

api 地址

OCR文字识别

检测上传图像中的文字,进行 AI 文字识别

http://openapiai.xueersi.com/v1/api/img/ocr/general

适用范围

任意操作系统,任意编程语言,均可以通过http或https调用本接口。

图像发送方式

图像数据支持两种形式发送:

URL

网络上的图片 URL 地址

图片数据

请求图片需经过base64编码:图片的base64编码指将一副图片编码成字符串数据,便于网络传输请求。您可以首先得到图片的二进制,进行base64编码后,然后再进行urlencode(注意你所使用的网络工具或网络库有没有默认的urlencode功能,如果没有,需要你自己显式转化)。

转码方式可参考

注意: 图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)

图片大小

不能大于4MB

长边不能超过4096px

短边不能小于15px

图像类型支持

图像数据支持以下原生类型:

jpg

png

jpeg

bmp

文字识别范围

目前,OCR识别接口服务支持多种类型文字,包括:

中文打印体识别

英文打印体识别

表格识别

拼音识别

请求方式

HTTP 方法:POST

请求 URL:http://openapiai.xueersi.com/v1/api/img/ocr/general

注意: Content-Type为application/x-www-form-urlencoded,然后通过urlencode格式化请求体。

Header 如下:

参数名

赋值

Content-Type

application/x-www-form-urlencoded

urlencode介绍

在请求 API 的 post 请求参数中含有图片url地址或base64字符。url地址 或 base64 字符作为参数传递时,需要把 中文 以及 '/' 做一下编码,防止解析中出现歧义,从而符合url的规范。

将中文 以及 '/'  转换为百分号编码形式,这就是 urlencode格式化操作。

部分语言的第三方包内部做了 urlencode 编码,不进行 urlencode 格式化也可以正常进行 API 请求,但    是进行 urlencode 格式化之后,一定可以通过请求。所以我们推荐您对请求体中的参数进行 urlencode 操作。

快速接入方式

请求参数详情

参数名

类型

是否必选

赋值说明

样例

备注

app_key

string

应用标识

8102b22a5e81e840176d9f381ec6f837

img

string

图像数据

https://i.loli.net/2019/03/22/5c94684fad743.jpg

图像 base64数据:示例数据较长,见附件

图像base64字符串 / 图像URL

img_type

string

图像形式

URL

base64 / URL

recog_formula

int

是否识别公式

0 -识别 | 1-不识别  ,默认0

请求代码示例

HTTP 代码示例:

POST /v1/api/img/ocr/general HTTP/1.1

Host: openapiai.xueersi.com

Content-Type: application/x-www-form-urlencoded

cache-control: no-cache

app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3a%2f%2fi.loli.net%2f2019%2f03%2f22%2f5c94684fad743.jpg&img_type=URL

cURL 代码示例:

curl -X POST \

http://openapiai.xueersi.com/v1/api/img/ocr/general \

-H 'Content-Type: application/x-www-form-urlencoded' \

-H 'cache-control: no-cache' \

-d 'app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3a%2f%2fi.loli.net%2f2019%2f03%2f22%2f5c94684fad743.jpg&img_type=URL'

PHP 代码示例:

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => "http://openapiai.xueersi.com/v1/api/img/ocr/general",

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => "",

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 30,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => "POST",

CURLOPT_POSTFIELDS => "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3a%2f%2fi.loli.net%2f2019%2f03%2f22%2f5c94684fad743.jpg&img_type=URL",

CURLOPT_HTTPHEADER => array(

"Content-Type: application/x-www-form-urlencoded",

"cache-control: no-cache"

),

));

$response = curl_exec($curl);

$err = curl_error($curl);

curl_close($curl);

if ($err) {

echo "cURL Error #:" . $err;

} else {

echo $response;

}

Python(Python3) 代码示例:

URL传参方式:

import http.client

conn = http.client.HTTPConnection("openapiai.xueersi.com")

payload = "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL"

headers = {

'Content-Type': "application/x-www-form-urlencoded",

'cache-control': "no-cache",

}

conn.request("POST", "/v1/api/img/ocr/general/", payload, headers)

res = conn.getresponse()

data = res.read()

#python2.7

#print(data)

#python3.6

print(data.decode("utf-8"))

conn.close()

base64传参方式:

import http.client

import urllib

import base64

from urllib import quote

with open('./test.jpg', 'rb') as bin_data:

image_data = bin_data.read()

image_data_base64 = base64.b64encode(image_data)

image_data_base64 = quote(image_data_base64)

conn = http.client.HTTPConnection("openapiai.xueersi.com")

appkey_string = 'app_key=8102b22a5e81e840176d9f381ec6f837'

img_string = 'img=' + image_data_base64

img_type_string = 'img_type=base64'

payload = appkey_string + '&' + img_string + '&' + img_type_string

headers = {

'Content-Type': "application/x-www-form-urlencoded",

'cache-control': "no-cache",

}

conn.request("POST", "/v1/api/img/ocr/general/", payload, headers)

res = conn.getresponse()

data = res.read()

print(data.decode("utf-8"))

conn.close()

C++(LibCurl) 代码示例:

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");

curl_easy_setopt(hnd, CURLOPT_URL, "http://openapiai.xueersi.com/v1/api/img/ocr/general");

struct curl_slist *headers = NULL;

headers = curl_slist_append(headers, "cache-control: no-cache");

headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");

curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3a%2f%2fi.loli.net%2f2019%2f03%2f22%2f5c94684fad743.jpg&img_type=URL");

CURLcode ret = curl_easy_perform(hnd);

Java 代码示例:

public static void QuickConnect(){

new Thread(new Runnable() {

@Override

public void run() {

try {

Map params = new HashMap();

params.put("app_key", "8102b22a5e81e840176d9f381ec6f837");

params.put("img","https://i.loli.net/2019/03/22/5c94684fad743.jpg");

params.put("img_type","URL");

Log.i(TAG,"start post");

String result = HttpUtil.sendPostMessage(params,"utf-8");

System.out.println("result->"+result);

}catch(Exception e)

{

e.printStackTrace();

}

}

}).start();

}

JavaScript 代码示例:

var settings = {

"async": true,

"crossDomain": true,

"url": "http://openapiai.xueersi.com/v1/api/img/ocr/general",

"method": "POST",

"headers": {

"Content-Type": "application/x-www-form-urlencoded",

"cache-control": "no-cache",

},

"data": {

"app_key": "8102b22a5e81e840176d9f381ec6f837",

"img": "https://ai.xueersi.com/textRecognition/images/22.jpg",

"img_type": "URL"

}

}

$.ajax(settings).done(function (response) {

console.log(response);

});

Go 代码示例:

package main

import (

"fmt"

"strings"

"net/http"

"io/ioutil"

)

func main() {

url := "http://openapiai.xueersi.com/v1/api/img/ocr/general"

payload := strings.NewReader("app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

req.Header.Add("cache-control", "no-cache")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()

body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)

fmt.Println(string(body))

}

C# 代码示例:

using System;

using System.IO;

using System.Net;

using System.Text;

namespace ConsoleApp1

{

class Program

{

static void Main(string[] args)

{

string celerityPost = CelerityPost();

Console.WriteLine("快速接入方式:\n" + celerityPost);

Console.ReadLine();

}

private static string CelerityPost()

{

string url = "http://openapiai.xueersi.com/v1/api/img/ocr/general";//URL地址

string payload = "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL";

CookieContainer cookieContainer = new CookieContainer();

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

webRequest.ContentLength = Encoding.UTF8.GetByteCount(payload);

webRequest.ContentType = "application/x-www-form-urlencoded";//Content-Type

webRequest.CookieContainer = cookieContainer;

webRequest.Method = "post";

Stream request = webRequest.GetRequestStream();

StreamWriter streamWriter = new StreamWriter(request, Encoding.GetEncoding("gb2312"));

streamWriter.Write(payload);

streamWriter.Close();

HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();

response.Cookies = cookieContainer.GetCookies(response.ResponseUri);

Stream returnStream = response.GetResponseStream();

StreamReader streamReader = new StreamReader(returnStream, Encoding.GetEncoding("utf-8"));

string endResult = streamReader.ReadToEnd();//返回结果

streamReader.Close();

returnStream.Close();

return endResult;

}

}

}

微信小程序 代码示例:

wx.request({

url: 'http://openapiai.xueersi.com/v1/api/img/ocr/general',

method: "post",

data:

{

app_key: "8102b22a5e81e840176d9f381ec6f837",

img: "https://ai.xueersi.com/textRecognition/images/22.jpg",

img_type: "URL",

},

header: {

"content-type": "application/x-www-form-urlencoded",

},

success(res) {

console.log(res.data)

}

})

iOS 代码示例:

NSURLSession *session = [NSURLSession sharedSession];

NSString *urlStr = @"http://openapiai.xueersi.com/v1/api/img/ocr/general";

NSURL *url = [NSURL URLWithString:urlStr];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

request.HTTPMethod = @"POST";

NSString *app_key = @"app_key=8102b22a5e81e840176d9f381ec6f837";

NSString *img = @"img=https://ai.xueersi.com/textRecognition/images/22.jpg";

NSString *img_type = @"img_type=URL";

NSString *paramsStr = [NSString stringWithFormat:@"%@&%@&%@", app_key, img, img_type];

request.HTTPBody = [paramsStr dataUsingEncoding:NSUTF8StringEncoding];

[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];

NSLog(@"result=%@",dict);

}];

[dataTask resume];

安全接入方式

请求参数详情

参数名

类型

是否必选

赋值说明

样例

备注

app_key

string

应用标识

8102b22a5e81e840176d9f381ec6f837

time_stamp

string

秒级时间戳

1493468759

安全接入必备,用于唯一地标识某一刻的时间

nonce_str

string

随机字符串

dd599ef889859f9fe

安全接入必备

sign

string

签名信息

99880aabb33f4def5c875875b6bdc3b1

安全接入必备

img_type

string

图像形式

URL

base64 / URL

recog_formula

int

是否识别公式

0 -识别 | 1-不识别  ,默认0

请求代码示例

HTTP 代码示例:

POST /v1/api/img/ocr/general HTTP/1.1

Host: openapiai.xueersi.com

Content-Type: application/x-www-form-urlencoded

cache-control: no-cache

app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a

cURL 代码示例:

curl -X POST \

http://openapiai.xueersi.com/v1/api/img/ocr/general \

-H 'Content-Type: application/x-www-form-urlencoded' \

-H 'cache-control: no-cache' \

-d 'app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a'

PHP 代码示例:

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => "http://openapiai.xueersi.com/v1/api/img/ocr/general",

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => "",

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 30,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => "POST",

CURLOPT_POSTFIELDS => "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a",

CURLOPT_HTTPHEADER => array(

"Content-Type: application/x-www-form-urlencoded",

"cache-control: no-cache"

),

));

$response = curl_exec($curl);

$err = curl_error($curl);

curl_close($curl);

if ($err) {

echo "cURL Error #:" . $err;

} else {

echo $response;

}

Python(Python3) 代码示例:

URL传参方式:

import http.client

conn = http.client.HTTPConnection("openapiai.xueersi.com")

payload = "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a"

headers = {

'Content-Type': "application/x-www-form-urlencoded",

'cache-control': "no-cache",

}

conn.request("POST", "/v1/api/img/ocr/general/", payload, headers)

res = conn.getresponse()

data = res.read()

#python2.7

#print(data)

#python3.6

print(data.decode("utf-8"))

conn.close()

base64传参方式:

import http.client

import urllib

import base64

from urllib import quote

with open('./test.jpg', 'rb') as bin_data:

image_data = bin_data.read()

image_data_base64 = base64.b64encode(image_data)

image_data_base64 = quote(image_data_base64)

conn = http.client.HTTPConnection("openapiai.xueersi.com")

appkey_string = 'app_key=8102b22a5e81e840176d9f381ec6f837'

img_string = 'img=' + image_data_base64

img_type_string = 'img_type=base64'

payload = appkey_string + '&' + img_string + '&' + img_type_string + '&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a'

headers = {

'Content-Type': "application/x-www-form-urlencoded",

'cache-control': "no-cache",

}

conn.request("POST", "/v1/api/img/ocr/general/", payload, headers)

res = conn.getresponse()

data = res.read()

print(data.decode("utf-8"))

conn.close()

C++(LibCurl) 代码示例:

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");

curl_easy_setopt(hnd, CURLOPT_URL, "http://openapiai.xueersi.com/v1/api/img/ocr/general");

struct curl_slist *headers = NULL;

headers = curl_slist_append(headers, "cache-control: no-cache");

headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");

curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a");

CURLcode ret = curl_easy_perform(hnd);

Java 代码示例:

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");

RequestBody body = RequestBody.create(mediaType, "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a");

Request request = new Request.Builder()

.url("http://openapiai.xueersi.com/v1/api/img/ocr/general")

.post(body)

.addHeader("Content-Type", "application/x-www-form-urlencoded")

.addHeader("cache-control", "no-cache")

.build();

Response response = client.newCall(request).execute();

JavaScript 代码示例:

var settings = {

"async": true,

"crossDomain": true,

"url": "http://openapiai.xueersi.com/v1/api/img/ocr/general",

"method": "POST",

"headers": {

"Content-Type": "application/x-www-form-urlencoded",

"cache-control": "no-cache",

},

"data": {

"app_key": "8102b22a5e81e840176d9f381ec6f837",

"img": "https://ai.xueersi.com/textRecognition/images/22.jpg",

"img_type": "URL",

"time_stamp": "1551174536",

"nonce_str": "W8FI8oCp",

"sign": "c08d8f9900479a3b2a348c1d7dc7e918e71be66a"

}

}

$.ajax(settings).done(function (response) {

console.log(response);

});

Go 代码示例:

package main

import (

"fmt"

"strings"

"net/http"

"io/ioutil"

)

func main() {

url := "http://openapiai.xueersi.com/v1/api/img/ocr/general"

payload := strings.NewReader("app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

req.Header.Add("cache-control", "no-cache")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()

body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)

fmt.Println(string(body))

}

C# 代码示例:

using System;

using System.IO;

using System.Net;

using System.Text;

namespace ConsoleApp1

{

class Program

{

static void Main(string[] args)

{

string safetyPost = SafetyPost();

Console.WriteLine("安全接入方式:\n" + safetyPost);

Console.ReadLine();

}

private static string SafetyPost()

{

string url = "http://openapiai.xueersi.com/v1/api/img/ocr/general";//URL地址

string payload = "app_key=8102b22a5e81e840176d9f381ec6f837&img=https%3A%2F%2Fai.xueersi.com%2FtextRecognition%2Fimages%2F22.jpg&img_type=URL&time_stamp=1551174536&nonce_str=W8FI8oCp&sign=7d15e530e58fcf3a020ec69b48d951010fa49322";

CookieContainer cookieContainer = new CookieContainer();

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);

webRequest.ContentLength = Encoding.UTF8.GetByteCount(payload);

webRequest.ContentType = "application/x-www-form-urlencoded";//Content-Type

webRequest.CookieContainer = cookieContainer;

webRequest.Method = "post";

Stream request = webRequest.GetRequestStream();

StreamWriter streamWriter = new StreamWriter(request, Encoding.GetEncoding("gb2312"));

streamWriter.Write(payload);

streamWriter.Close();

HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();

response.Cookies = cookieContainer.GetCookies(response.ResponseUri);

Stream returnStream = response.GetResponseStream();

StreamReader streamReader = new StreamReader(returnStream, Encoding.GetEncoding("utf-8"));

string endResult = streamReader.ReadToEnd();//返回结果

streamReader.Close();

returnStream.Close();

return endResult;

}

}

}

微信小程序 代码示例:

wx.request({

url: 'http://openapiai.xueersi.com/v1/api/img/ocr/general',

method: "post",

data:

{

app_key: "8102b22a5e81e840176d9f381ec6f837",

img: "https://ai.xueersi.com/textRecognition/images/22.jpg",

img_type: "URL",

time_stamp: "1551174536",

nonce_str: "W8FI8oCp",

sign: "c08d8f9900479a3b2a348c1d7dc7e918e71be66a"

},

header: {

"content-type": "application/x-www-form-urlencoded",

},

success(res) {

console.log(res.data)

}

})

iOS 代码示例:

NSURLSession *session = [NSURLSession sharedSession];

NSString *urlStr = @"http://openapiai.xueersi.com/v1/api/img/ocr/general";

NSURL *url = [NSURL URLWithString:urlStr];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

request.HTTPMethod = @"POST";

NSString *app_key = @"app_key=8102b22a5e81e840176d9f381ec6f837";

NSString *img = @"img=https://ai.xueersi.com/textRecognition/images/22.jpg";

NSString *img_type = @"img_type=URL";

NSString *time_stamp = @"time_stamp=1551174536";

NSString *nonce_str = @"nonce_str=W8FI8oCp";

NSString *sign = @"sign=c08d8f9900479a3b2a348c1d7dc7e918e71be66a";

NSString *paramsStr = [NSString stringWithFormat:@"%@&%@&%@&%@&%@&%@", app_key, img, img_type, time_stamp, nonce_str, sign];

request.HTTPBody = [paramsStr dataUsingEncoding:NSUTF8StringEncoding];

[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];

NSLog(@"result=%@",dict);

}];

[dataTask resume];

返回响应

返回格式

JSON格式

响应参数说明

参数名

类型

赋值说明

样例

备注

code

string

返回码

0

msg

string

返回码解释

"请求成功"

data

object

识别数据结构

数据结构

content

array

识别文本数组

["学而思网校"]

数组中每一个元素代表一行识别文本

loc

array

图像中的图形位置

[[123,76,202,157]]

左上角点坐标,右下角点坐标 ,图像中无图形时为空

recognition

object

详细识别信息结构

数据结构

包含图表信息,文本单字信息,英文单词信息,支持拼音识别

ocrId

string

唯一的id

"03-20-17-57-27-040-32c6e327d0573a9aac8480dc63f8908f"

用于定位问题

ocrLinesList

array

识别对象数组

识别对象可为图表、一行文本

type

string

对象类型

包含"word"、"table"、"p"三种类型,分别表示文字,图表,行/段落

alp

object

拼音对象

当图像中文字包含拼音时,返回结果中文字包含拼音对象

row

int

行合并数

1

表格单元包含的行数

col

int

列合并数

1

表格单元包含的列数

lineNum

int

表格单元所在行数

2

表格单元的起始行数

响应代码示例

响应Body:

{

"code": 0,

"msg": "请求成功",

"data": {

"recognition": {

"ocrId": "03-20-17-57-27-040_32c6e327d0573a9aac8480dc63f8908f",

"ocrLinesList": [

{

"data": [

{

"alp": null,

"height": 29,

"type": "word",

"value": "形",

"width": 27,

"x": 82,

"y": 56

},

{

"type": "word",

"x": 96,

"y": 56,

"width": 27,

"height": 29,

"value": "成",

"alp": {

"value": "chéng",

"x": 90,

"y": 30,

"width": 35,

"height": 18

}

}

],

"type": "p"

},

{

"type": "table",

"size": {

"width": "80px",

"height": "50px"

},

"linePos": [

{

"row": 1,

"col": 1,

"lineNum": 2,

"data": [

{

"type": "p",

"data": [

{

"type": "word",

"x": 70,

"y": 100,

"width": 29,

"height": 27,

"value": "他",

"alp": null

}

]

}

]

}

]

}

]

},

"content": [

"形成(chéng)",

"他"

],

"loc": [

[

120,

70,

210,

150

]

]

}

}

常见问题及反馈

ocr文字识别 php源码,OCR文字识别相关推荐

  1. android tensorflow文字识别身份证识别ocr文字识别商用源码

    一 ,文字识别简介 计算机文字识别,俗称光学字符识别,英文全称是Optical Character Recognition(简称OCR),它是利用光学技术和计算机技术把印在或写在纸上的文字读取出来,并 ...

  2. python图片转文字_【收藏】图片转成文字的方法总结,python批量图片转文字信息参考源码...

    在日常办公或者学习中,往往存在这样一个工作场景,比如,"老王,我这里有一张图片,你把里面的文字信息给我整理出来",都2021年了,你真的还在手敲图片文字信息么?那么还不赶紧收藏这篇 ...

  3. 【收藏】图片转成文字的方法总结,python批量图片转文字信息参考源码

    在日常办公或者学习中,往往存在这样一个工作场景,比如,"老王,我这里有一张图片,你把里面的文字信息给我整理出来",都2021年了,你真的还在手敲图片文字信息么?那么还不赶紧收藏这篇 ...

  4. Java开源的ERP系统源码带文字搭建教程,前后端分离架构

    Java前后端分离开源ERP系统源码带文字搭建教程 源码分享!需要源码学习可私信. 该系统是前后端分离的架构,前端使用Vue2.6.10,后端使用SpringBoot2.0.0. 技术框架:Sprin ...

  5. CSS实现的阴影的3D立体文字动画网页源码

    大家好,今天给大家介绍一款,炫酷的阴影的3D立体文字动画网页源码(图1).送给大家哦,获取方式在本文末尾. 图1 由两组文字构成,都有阴影,加上左右晃动,3D效果很明显(图2) 图2 响应式页面,支持 ...

  6. PHP在线文字转语音合成源码

    介绍: 该源码是PHP在线文字转语音合成源码,基于百度API开发,在线文本转换语音,免去下载软件直接在线文本转语音,方便简单! 网盘下载地址: https://zijiewangpan.com/8nK ...

  7. PHP在线文字转语音合成源码 基于百度API开发

    介绍: PHP在线文字转语音合成源码 基于百度API开发 网盘下载地址: https://zijiewangpan.com/zCErg2PByjO 图片:

  8. PHP在线考试平台管理系统源码带文字搭建教程

    PHP在线考试平台管理系统源码带文字搭建教程和操作手册 技术架构 PHP7.2 + Thinkphp6 + React + UmiJs + nginx + mysql5.7 cnetos7以上 + 宝 ...

  9. PHP云课堂在线学习平台源码带文字安装教程

    云课堂在线学习平台源码带文字安装教程 运行环境 服务器宝塔面板 PHP 5.6 Mysql 5.5及以上版本 Linux Centos7以上 这是一个功能齐全的云课堂在线学习平台,包括有直播系统,点播 ...

最新文章

  1. 基于PyTorch的Seq2Seq翻译模型详细注释介绍(一)
  2. 关于Java为什么配置好环境变量但是不能在命令行cmd运行javac的问题
  3. python 高级使用实例_Python中的高级函数map/reduce使用实例
  4. mysql数据传输完整性_Mysql——数据库完整性
  5. 动态规划-最长上升子序列(LIS)
  6. 文件浏览器及数码相框 -2.3.2-freetype_arm-1
  7. 数字五笔输入法,特别版
  8. 虚拟光驱下载安装和使用,Windows系统如何直接打开iso文件
  9. 人工神经网络的算法原理,人工智能神经网络算法
  10. 等保三级 MySql数据库通用测评知识
  11. M0n0Wall防火墙安装配置
  12. 二叉树期权定价python代码_期权的二叉树定价模型
  13. 为什么常用二倍图,流式布局中一倍图是否靠得住
  14. ALexa网站排名查询
  15. Java工程师胜任力素质模型,胜任力故事汇编C47│AspiringMinds:高潜力程序员的胜任力素质模型...
  16. 猪场超级管家 v4.0 免费
  17. 撰写测试用例----二维码支付
  18. oracle删除redo 未重启,卸载金山和瑞星后未重启就安装了卡巴,系统进不去了
  19. DCOS之k8s的容器监测探针
  20. 《初入linux》--第二十部分-Apache服务器的几个实用技巧

热门文章

  1. 犀牛书第七版学习笔记:let、const和 var 声明与赋值
  2. 服务器系统可以使用软件吗,云服务器可以运行软件吗
  3. 阿里云接口----OSS文件上传
  4. 计算机软件实习项目一 简单计算器 (Qt实现计算器界面) 12-5
  5. 单位冲激响应和单位阶跃响应
  6. Excel 表单控件在工作表大小和位置固定方法
  7. [Windows]_[初级]_[使用7z命令行工具进行打包备份]
  8. 向量沿着另一个向量旋转
  9. linux mint 下安装matplotlib
  10. c语言生成1000 9999随机数,产生随机数(rand()函数和srand()函数)