图片识别接入文档
文档状态
| 文件标识: | TuringOS-IRT-V1.0 |
|---|---|
| 系统版本: | SDK |
| 完成日期: | 2022年10月24日 |
文档修订记录
| 文档版本号 | 修订日期 | 修订原因 |
|---|---|---|
| V1.0 | 2022.11.24 | 创建文档 |
| V1.1 | 2023.03.27 | 返回手写体、印刷体坐标,详情见 Text 类。 变更字段 1. 去掉 handWrite 字段,手写体文本见 Text 类 ; 2. text 字段由 List< String > 类型改为 Text 类型。 |
| V1.2 | 2023.05.06 | 1.增加arithmetic字段,是否是口算题 2.增加alignListOfString 方法 |
| V1.3 | 2023.06.02 | 1.PageSplitData增加globalId字段 |
| V1.4 | 2023.07.20 | 1.修改试卷分析(拆录)接口 2.修改弯曲矫正接口 |
| V1.5 | 2023.11.06 | 1. pageRetrieval() 为题目框选接口 2. 新增版面分析接口 paragraphParse() |
概述
此模块主要包括图片识别相关能力,如下:
-
整题识别(需开启整体识别技能)
-
去除手写 (开启去除手写技能)
-
通用OCR (开启技能⼿写⽂字识别)
-
题目框选(需开启题目框选技能)
-
版面分析(需开启版面分析技能)
-
搜题
-
试卷分析
-
弯曲矫正
集成步骤
1. 添加依赖库
//必须依赖库
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation "org.java-websocket:Java-WebSocket:1.4.0"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.aliyun.dpa:oss-android-sdk:2.9.11'//SDKV2.4.1.25 以后需加入
2. AndroidManifest配置
添加权限
<!--网络-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!--文件读写-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--deviceID-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--相机-->
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<!-- 读取手机状态,获取IMEI -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<!-- android 10 在application节点添加以下适配高版本 -->
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
3. 代码混淆
代码混淆文件proguard-project.txt,添加如下内容
-keep class com.turing.**{ *;}
-dontwarn com.turing.**
-keep class org.java_websocket.**{*;}
-dontwarn org.java_websocket.**
-keep class org.slf4j.**{*;}
-dontwarn org.slf4j.**
-keep class org.eclipse.** { *; }
-dontwarn org.eclipse.**
4. SDK 初始化
使用图片识别功能前调用,请先调用SDK初始化代码。SDK初始化详情见《Android SDK接入指南说明文档》
TuringInitializer.getInstance().initV3XXX()
5. 开启功能集成
使用说明见下面【功能集成】描述。
实例化
var turingIrt = TuringIrt.getInstance(this)
功能集成
图片来源为:通过SDK 内部相机获取图片 或 客户端传入图片。
init=>start: 初始化init
takePic=>operation: 拍照takePicture
function=>operation: 具体功能接口
deal=>operation: 处理回调数据
release=>end: 释放资源
init->takePic->function->deal->release
1. 初始化
调用所有接口前,需要先调用此接口进行初始化。如果不使用SDK内置Camera取图,则参数可传入null。
方法
void init(CameraConfig config, ViewGroup layout, CameraListener listener);
输入说明
| 参数 | 类型 | 说明 |
|---|---|---|
| config | CameraConfig | CameraConfig |
| layout | ViewGroup | 预览界面的布局,建议使用FrameLayout |
| listener | CameraListener | 回调接口 |
- CameraConfig
| 参数 | 类型 | 取值范围 | 说明 |
|---|---|---|---|
| cameraId | int | 0:后置,1:前置 | 摄像头Id 1前置 0后置 |
| mirror | boolean | - | 图片是否镜像处理 |
| preMirror | boolean | - | 预览是否镜像处理 |
| rotation | int | 90,180,270,360 | 旋转角度 |
| pictureSize | android.util.Size | 摄像头支持的ImageFormat.JPEG拍照分辨率 | 图片分辨率 |
| previewSize | android.util.Size | 摄像头支持的分辨率 | 预览分辨率 |
| preRotation | int | 90,180,270,360 | 预览角度 |
| debugImage | boolean | - | 是否写入本地debug图片 |
| quality | int | 0-100 | 图片质量 |
- MessageEvent#getCode
| 参数 | 值 | 说明 |
|---|---|---|
| MessageEvent.CAMERA_STATES_OPENING | 1 | 相机状态 时机:调用了开启相机方法 |
| MessageEvent.CAMERA_STATES_OPENED | 2 | 相机状态 时机:CameraDevice.StateCallback#onOpened |
| MessageEvent.CAMERA_STATES_CLOSEING | 3 | 相机状态 时机:调用了关闭相机方法 |
| MessageEvent.CAMERA_STATES_DISCONNECTED | 4 | 相机状态 时机:CameraDevice.StateCallback#onDisconnected |
| MessageEvent.CAMERA_STATES_CLOSED | 5 | 相机状态 时机:CameraDevice.StateCallback#onClosed |
| MessageEvent.CAMERA_STATES_ERROR | 6 | 相机状态 时机:CameraDevice.StateCallback#onError |
输出说明
- CameraListener
public interface CameraListener {
/**
* 错误回调
* @param errorCode
* @param msg
*/
void onError(int errorCode,String msg);
/**
* 相机状态回调
* @param messageEvent
*/
void onEvent(MessageEvent messageEvent);
}
2.使用SDK内置相机
使用 SDK 内置相机,那么 初始化方法 init() 中 config 、layout 字段值不能为null。
2.1 拍照
方法
void takePicture(TakePicListener listener);
输出说明
TakePicListener 说明
public interface TakePicListener {
/**
* 图片回调
* @param image 图片数据,格式为JPEG
*/
void onPicture(byte[] image);
/**
* 错误回调
* @param errorCode
* @param msg
*/
void onError(int errorCode,String msg);
}
2.2 暂停/重新开始预览
方法
/**
* 暂停预览(SDK内置Camera)
*/
void pause();
/**
* 重新开始预览(SDK内置Camera)
*/
void resume();
3 整题识别
方法
void questionOcr(IRTConfig irtConfig, TuringListener<Parameters> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 |
| imageFormat | ImageFormat | N | 图片格式,目前仅支持JPEG(默认) |
IRTConfig#image规则说明:
1.如果使用SDK内置相机,IRTConfig#image参数可不传数据,SDK内部会自动获取客户端调用takePicture()得到的拍照图片。
2.如果自行实现 拍照 或 裁剪流程,IRTConfig#image 参数需要传入图片数据。
输出说明
Parameters 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| warnCode | int | 异常码 -1:请求失败 -2:请求参数错误 |
| resultMsg | json | 识别结果-输出顺序(行)从上到下,(单行)从左至右 |
| resultMsg-text | String | 识别文本 |
| resultMsg-boundingBox | String | 区域矩形坐标 |
| resultMsg-type | String | 识别类型 text:文本;formula:公式;graph :识别图片坐标 |
| resultMsg-x | int | type=graph时输出 识别区域矩形左上角点x坐标以上传图片的左上角为原点,横向为x轴(向右为正),纵向为y轴(向下为正) |
| resultMsg-y | int | type=graph时输出 识别区域矩形左上角点y坐标以上传图片的左上角为原点,横向为x轴(向右为正),纵向为y轴(向下为正) |
| resultMsg-width | int | type=graph时输出,识别区域矩形宽度 |
| resultMsg-height | type=graph时输出,识别区域矩形高度 |
注意:boundingBox:坐标,共八个值:分别是左上角坐标(x,y),右上角坐标(x,y),右下角坐标(x,y),左下角(x,y),原点为左上角坐标。
返回示例:
{
"globalId": "109077640666110003",
"intent": {
"code": 1000704,
"operateState": 1010,
"parameters": {
"resultMsg": [{
"text": "1. 2022年1月,中国锦屏深地实验室发表了首个核天体物理研究实验成果。表明我国",
"type": "text"
},
{
"text": "核天体物理研究已经跻身国际先进行列。实验中所用核反应方程为",
"type": "text"
},
{
"text": "x + \\frac { 25 } { 12 } Mg _ { 2 } - \\frac { 26 } { 13 } A",
"type": "formula"
},
{
"text": "已知",
"type": "text"
},
{
"text": "x _ { 1 } ^ { 25 } lgg _ { 2 } ^ { 26 } A",
"type": "formula"
},
{
"text": "的质量分别为",
"type": "text"
},
{
"text": "m _ { 1 } , m _ { 2 } , m _ { 3 }",
"type": "formula"
},
{
"text": ",真空中的光速为",
"type": "text"
},
{
"text": "c",
"type": "formula"
},
{
"text": "该反应中释",
"type": "text"
},
{
"text": "放的能量为",
"type": "text"
},
{
"text": "E",
"type": "formula"
},
{
"text": "。下列说法正确的是(",
"type": "text"
},
{
"text": "A.x",
"type": "formula"
},
{
"text": "为氘核",
"type": "text"
},
{
"text": "_ { 2H } ^ { 2 }",
"type": "formula"
},
{
"text": "B.x",
"type": "formula"
},
{
"text": "为氚核",
"type": "text"
},
{
"text": "3H",
"type": "formula"
},
{
"text": "E = ( m _ { 1 } + m _ { 2 } + m _ { 3 } ) c ^ { 2 }",
"type": "formula"
},
{
"text": "E = ( m _ { 1 } + m _ { 2 } - m _ { 3 } ) c ^ { 2 }",
"type": "formula"
}
]
}
}
}
请求示例
private var imageData: ByteArray? = null
turingIrt.takePicture(object :
TakePicListener {
override fun onPicture(image: ByteArray?) {
imageData = image
}
override fun onError(errorCode: Int, msg: String?) {
showToast(msg)
}
})
val builder = IRTConfig.Builder();
if (imageData != null) {
builder.setImage(imageData)
turingIrt.questionOcr(builder.build(),questionListener)
} else
turingIrt.questionOcr(builder.build(),questionListener)
4. 手写擦除
识别混合文本中的手写体,进行擦除。
方法
void removeHandwriting(IRTConfig irtConfig, TuringListener<ResultMsgBean> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 |
| imageFormat | ImageFormat | N | 图片格式,目前仅支持JPEG(默认) |
IRTConfig#image规则说明,同【整题识别中规则说明】。
输出说明
ResultMsgBean 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| warnCode | int | 异常码,-1:请求失败。-2:请求参数错误。 |
| resultMsg | json | 识别结果 |
| originalImg | byte[] | base64编码,原图 |
| eraseEnhanceImg | byte[] | base64编码,图像擦除后图⽚ |
请求示例
private var imageData: ByteArray? = null
turingIrt.takePicture(object :
TakePicListener {
override fun onPicture(image: ByteArray?) {
imageData = image
}
override fun onError(errorCode: Int, msg: String?) {
showToast(msg)
}
})
var hanConfig = IRTConfig.Builder().setImage(imageData).setAngle(1).build()
turingIrt.removeHandwriting(hanConfig, removeListener)
5 通用OCR服务
通用OCR主要是将图片中印刷或手写的文字转化为计算机可编码的文字,目前支持中文、英文。
方法
void commonOcr(IRTConfig irtConfig, TuringListener<CommonRecognitionBean> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 注:图片大小不超过4M |
| langType | String | Y | 语⾔类型,en/zh-CHS(英⽂/中⽂) |
IRTConfig#image规则说明,同【整题识别中规则说明】。
输出说明
CommonRecognitionBean 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| resultMsg | ResultMsg | 结果详情 |
| warnCode | int | 错误code |
ResultMsg 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| pages | array-PagesBean | 页面集合 |
| category | string | 附加信息 |
| version | string | 版本号 |
resultMsg-PagesBean
| 参数 | 类型 | 说明 |
|---|---|---|
| exception | int | 正常返回 0 异常返回 -1 |
| width | int | 页面宽度 |
| height | int | 页面高度 |
| angle | float | 图像的旋转角度 |
| lines | array-LineBean | 文本行集合 |
resultMsg-PagesBean - LineBean
| 参数 | 类型 | 说明 |
|---|---|---|
| exception | int | 正常返回 0 异常返回 -1 |
| angle | float | 文本行的旋转角度 |
| conf | float | 置信度,取值范围[0-1] |
| coord | array-CoordBean | 文本行坐标,记录4个顶点位置 |
| words | array-WordsBean | 单词集合 |
| word_units | array-WordUnitsBean | 单字集合 |
CoordBean
| 参数 | 类型 | 说明 |
|---|---|---|
| x | int | 文本行坐标4个顶点x轴的位置信息 |
| y | int | 文本行坐标4个顶点y轴的位置信息 |
WordsBean
| 参数 | 类型 | 说明 |
|---|---|---|
| conf | float | 置信度,取值范围[0-1] |
| content | string | 识别结果文本 |
| coord | array-CoordBean | 单词坐标,记录4个顶点位置 |
WordUnitsBean
| 参数 | 类型 | 说明 |
|---|---|---|
| content | string | 字符(中文单字,英文单个字母) |
| conf | float | 置信度,取值范围[0-1] |
| center_point | CenterPointBean | 单字中心点的坐标 |
| coord | array-CoordBean | 单字坐标,记录4个顶点位置 |
CenterPointBean
| 参数 | 类型 | 说明 |
|---|---|---|
| x | int | 单字中心点的坐标的x轴位置信息 |
| y | int | 单字中心点的坐标的y轴位置信息 |
返回示例:
{
"globalId": "1011037140376410001",
"intent": {
"code": 1000827,
"operateState": 1010,
"parameters": {
"resultMsg": {
"pages": [{
"exception": 0,
"width": 189,
"angle": 0,
"lines": [{
"exception": 0,
"coord": [{
"x": 23,
"y": 7
},
{
"x": 154,
"y": 7
},
{
"x": 154,
"y": 38
},
{
"x": 23,
"y": 38
}
],
"words": [{
"coord": [{
"x": 23,
"y": 7
},
{
"x": 153,
"y": 7
},
{
"x": 153,
"y": 39
},
{
"x": 23,
"y": 39
}
],
"conf": 0.971464157,
"content": "爱我中华"
}],
"angle": 0,
"conf": 0.971464157,
"word_units": [{
"center_point": {
"x": 35,
"y": 22
},
"coord": [{
"x": 23,
"y": 7
},
{
"x": 47,
"y": 7
},
{
"x": 47,
"y": 39
},
{
"x": 23,
"y": 39
}
],
"conf": 0.996067762,
"content": "爱"
},
{
"center_point": {
"x": 67,
"y": 23
},
"coord": [{
"x": 48,
"y": 7
},
{
"x": 86,
"y": 7
},
{
"x": 86,
"y": 39
},
{
"x": 48,
"y": 39
}
],
"conf": 0.894529223,
"content": "我"
},
{
"center_point": {
"x": 101,
"y": 23
},
"coord": [{
"x": 87,
"y": 7
},
{
"x": 115,
"y": 7
},
{
"x": 115,
"y": 39
},
{
"x": 87,
"y": 39
}
],
"conf": 0.997510195,
"content": "中"
},
{
"center_point": {
"x": 134,
"y": 23
},
"coord": [{
"x": 116,
"y": 7
},
{
"x": 153,
"y": 7
},
{
"x": 153,
"y": 39
},
{
"x": 116,
"y": 39
}
],
"conf": 0.997749269,
"content": "华"
}
]
}],
"height": 47
}],
"category": "ch_en_public_cloud",
"version": "3.5.0.2094"
}
}
}
}
请求示例
private var imageData: ByteArray? = null
turingIrt.takePicture(object :
TakePicListener {
override fun onPicture(image: ByteArray?) {
imageData = image
}
override fun onError(errorCode: Int, msg: String?) {
showToast(msg)
}
})
val comConfig = IRTConfig.Builder()
.setImage(imageData)
//此处的imageData 可使用SDK的takePicture接口返回的(使用此接口时,可以不传此参数),也可以自行实现拍照或 压缩图片
.build()
turingIrt.commonOcr(comConfig,commonListener)
private val commonListener = object : TuringListener<CommonRecognitionBean> {
override fun onSuccess(result: CommonRecognitionBean?) {
if (result != null) {
Log.e(TAG, "code:${result.resultMsg.toString()}")
}
runOnUiThread {
if (result != null) {
binding.tvMessage.text = result.resultMsg.toString()
};
}
}
override fun onError(code: Int, message: String?) {
showToast(message)
}
}
6. 题目框选
自动识别图片中的题目并进行框选,返回题目讲解视频,根据文字识别模型,返回题目在图片中的位置信息,方便用户针对所框选的内容进行二次处理。
方法
void pageRetrieval(IRTConfig irtConfig, TuringListener<RetrievalData> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 |
| anchor | int[] | N | 锚点位置[x,y],以图像左上角为坐标原点。 若不填写,或者填写非法值,则以图片中心点作为锚点位置(单位: 像素) |
IRTConfig#image规则说明,同【整题识别中规则说明】。
输出说明
RetrievalData.ResultMsg
| 参数 | 类型 | 是否必返 | 说明 |
|---|---|---|---|
| single | List\ |
N | 离锚点最近的检测框坐标。(单位:像素) |
| rotate | int | N | 图像旋转角度,取值:[0, 90, 180, 270] |
| data | List\ |
N | 题目信息。(单位:像素) |
| full_time | int | N | 请求处理时长,单位:毫秒 |
| process_time | int | N | 算法处理时长,单位:毫秒 |
RetrievalPosition
| 参数 | 类型 | 是否必返 | 说明 |
|---|---|---|---|
| itemPosition | List\
|
N | 检测框坐标:先左上, 顺时针。是一个矩形 |
| itemPositionShow | List\
|
N | 展示框框坐标:先左上, 顺时针。是一个矩形 |
| itemPositionRotate | List\
|
N | 四边形的坐标:先左上, 顺时针。不一定是一个 |
请求示例
private var imageData: ByteArray? = null
turingIrt.takePicture(object :
TakePicListener {
override fun onPicture(image: ByteArray?) {
imageData = image
}
override fun onError(errorCode: Int, msg: String?) {
showToast(msg)
}
})
val point = intArrayOf(1,2)
val pageConfig = IRTConfig.Builder()
.setAnchor(point)
.setImage(imageData)
//此处的imageData 可使用SDK的takePicture接口返回的(使用此接口时,可以不传此参数),也可以自行实现拍照压缩图片
turingIrt.pageRetrieval(pageConfig.build(),retrievalListener)
7. 搜题
方法
void searchQuestion(IRTConfig config, TuringListener<SQuestionData> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 注:最大支持图片为1M,宽高必须大于30px,小于1080p。 |
| SQuestionMap | Map\ |
N | 搜题拓展参数 |
IRTConfig#image规则说明,同【整题识别中规则说明】。
输出说明
ResultMsg#QuestionBean参数说明:
| 名称 | 类型 | 含义 | 备注 |
|---|---|---|---|
| question | string | 解密questionArr后的题目html标签 | |
| hint | string | 解密questionArr后的解析html标签 | |
| answer | string | 解密questionArr后的答案html标签 | |
| css | array | 解密questionArr后的答案css数组 | |
| js | array | 解密questionArr后的答案js数组 | |
| id | string | 问题的标识 |
请求示例
val config =IRTConfig.Builder()
config.setImage(imageData)
turingIrt.searchQuestion(config.build(),searchQuesListener)
private val searchQuesListener = object : TuringListener<SQuestionData> {
override fun onSuccess(result: SQuestionData?) {
if (result != null) {
Log.e(TAG, "code:${result.resultMsg.toString()}")
}
runOnUiThread {
if (result != null) {
binding.tvMessage.text = result.resultMsg.toString()
};
}
}
override fun onError(code: Int, message: String?) {
Log.e(TAG, "errorCode:${code}")
showToast(message)
}
}
8. 试卷拆录
可对试卷的版面进行识别拆分,输出图、表、标题、文本的位置,并输出分版块内容的OCR识别结果,支持中、英两种语言,手写、印刷体混排多种场景,并返回文字在图片中的位置信息便于比对,满足试卷快速录入和搜题的需求。
方法
void examPageSplit(PageSplitConfig config, TuringListener<PageSplitData> listener);
输入说明
PageSplitConfig
| 参数 | 类型 | 说明 |
|---|---|---|
| angle | int | 旋转角度(顺时针),建议使用默认值。 默认:-1 -1:模型自动旋转; 直接旋转参数为90、180、270度 |
| image | byte[] | 图片数据 |
| ifReg | boolean | 是否调用通用印刷文字识别。默认:true |
| ifMath | boolean | 是否调用公式识别。默认:true |
| function | boolean | 是否调用手写识别。默认:true |
PageSplitConfig#image规则说明,同【整题识别中规则说明】。
输出说明
PageSplitData 类说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| resultMsg | ResultMsg | 识别结果 |
| globalId | String | 请求id |
resultMsg 字段说明
| 参数 | 类型 | 说明 |
|---|---|---|
| resultNum | int | 结果数量 |
| result | List\ |
识别后多张图片的结果 |
result 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| rotateAngle | int | 旋转角度。 如果angle 由外部送入,rotate_angle 为外部角度,返回坐标是原图坐标; 如果外部参数未指定angle,rotate_angle为算法求得,返回坐标是原图坐标。 |
| columnSize | int | 栏的数量 |
| data | List\
|
单页数据 |
data 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| ifInsert | int | 是否与上一栏或页的框合并 0-不合并 1-合并 |
| location | Location | 结构位置 |
| text | Text | 识别的文本(包含印刷体文本、公式、手写体) |
| type | String | 当前类型框类型 title:题干 text:题目文本 |
| graph | List\ |
该题目框包含图 |
| sheet | List\ |
该题目框包含表 |
| arithmetic | boolean | 返回的值为 true 时,表示当前题目是口算批改题, 反之则不是口算批改题 |
location 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| height | int | 结构框的宽 |
| width | int | 结构框的高 |
| x | int | 结构框左上角点的横坐标 |
| y | int | 结构框左上角点的纵坐标 |
text 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| singleBox | List\ |
文本详情 |
| text | List\ |
识别到的文本 |
text-singleBox 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| height | int | 结构框的宽 |
| width | int | 结构框的高 |
| x | int | 结构框左上角点的横坐标 |
| y | int | 结构框左上角点的纵坐标 |
| text | String | 文本 |
| isPrint | boolean | 是否为印刷体 true-印刷体 false-手写体 |
graph 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| graphloc | Location | 图的位置 |
| quadLocation | List\ |
四角定位 |
sheet 字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| sheetloc | Location | 表的位置 |
| quadLocation | List\ |
四角定位 |
quadLocation字段说明:
| 参数 | 类型 | 说明 |
|---|---|---|
| x | int | 横坐标 |
| y | y | 纵坐标 |
返回示例:
{
"result": [{
"column_size": 1,
"data": [
[{
"if_insert_new": 0,
"location": {
"height": 70,
"width": 628,
"x": 153,
"y": 424
},
"quad_location": [{
"x": 154,
"y": 423
}, {
"x": 780,
"y": 444
}, {
"x": 778,
"y": 493
}, {
"x": 153,
"y": 473
}],
"text_new": {
"singleBox": [{
"height": 61,
"is_print": true,
"text": "一、选择正确答案的序号填在括号里。(5分)",
"width": 618,
"x": 155,
"y": 422
}],
"text": ["一、选择正确答案的序号填在括号里。(5分)"]
},
"type": "title"
}, {
"graph": [{
"graphloc": {
"height": 172,
"width": 706,
"x": 498,
"y": 590
},
"quad_location": [{
"x": 1202,
"y": 589
}, {
"x": 1202,
"y": 760
}, {
"x": 498,
"y": 760
}, {
"x": 498,
"y": 589
}]
}],
"if_insert_new": 0,
"location": {
"height": 346,
"width": 1025,
"x": 193,
"y": 487
},
"quad_location": [{
"x": 199,
"y": 486
}, {
"x": 1217,
"y": 507
}, {
"x": 1210,
"y": 833
}, {
"x": 193,
"y": 812
}],
"text_new": {
"singleBox": [{
"height": 45,
"is_print": true,
"text": "1.如图,阴影部分(",
"width": 259,
"x": 202,
"y": 492
}, {
"height": 90,
"is_print": false,
"text": "##B##",
"width": 50,
"x": 479,
"y": 498
}, {
"height": 42,
"is_print": true,
"text": ")的面积最大。",
"width": 189,
"x": 523,
"y": 511
}, {
"height": 31,
"is_print": false,
"text": "##×##",
"width": 23,
"x": 201,
"y": 527
}, {
"height": 23,
"is_print": true,
"text": "3",
"width": 18,
"x": 1081,
"y": 595
}, {
"height": 26,
"is_print": true,
"text": "3",
"width": 18,
"x": 555,
"y": 715
}, {
"height": 26,
"is_print": true,
"text": "6",
"width": 18,
"x": 810,
"y": 723
}, {
"height": 26,
"is_print": true,
"text": "4",
"width": 20,
"x": 1066,
"y": 729
}, {
"height": 39,
"is_print": true,
"text": "A.平行四边形",
"width": 202,
"x": 232,
"y": 759
}, {
"height": 42,
"is_print": true,
"text": "B.三角形",
"width": 134,
"x": 629,
"y": 770
}, {
"height": 47,
"is_print": true,
"text": "C.梯形",
"width": 110,
"x": 1008,
"y": 778
}],
"text": ["1.如图,阴影部分( ##B##)的面积最大。", "##×##", "3", "3 6 4", "A.平行四边形 B.三角形 C.梯形"]
},
"type": "text"
}, {
"graph": [{
"graphloc": {
"height": 59,
"width": 108,
"x": 1043,
"y": 921
},
"quad_location": [{
"x": 1149,
"y": 921
}, {
"x": 1149,
"y": 979
}, {
"x": 1042,
"y": 979
}, {
"x": 1042,
"y": 921
}]
}, {
"graphloc": {
"height": 58,
"width": 89,
"x": 663,
"y": 908
},
"quad_location": [{
"x": 663,
"y": 908
}, {
"x": 751,
"y": 908
}, {
"x": 751,
"y": 965
}, {
"x": 663,
"y": 965
}]
}, {
"graphloc": {
"height": 66,
"width": 69,
"x": 265,
"y": 891
},
"quad_location": [{
"x": 265,
"y": 891
}, {
"x": 333,
"y": 891
}, {
"x": 333,
"y": 956
}, {
"x": 265,
"y": 956
}]
}],
"if_insert_new": 0,
"location": {
"height": 166,
"width": 971,
"x": 191,
"y": 821
},
"quad_location": [{
"x": 193,
"y": 820
}, {
"x": 1160,
"y": 833
}, {
"x": 1158,
"y": 986
}, {
"x": 190,
"y": 972
}],
"text_new": {
"singleBox": [{
"height": 55,
"is_print": true,
"text": "2.下列图形中有两条对称轴的图形是(",
"width": 522,
"x": 193,
"y": 821
}, {
"height": 90,
"is_print": false,
"text": "##B##",
"width": 45,
"x": 728,
"y": 821
}, {
"height": 31,
"is_print": true,
"text": ")。",
"width": 28,
"x": 775,
"y": 845
}, {
"height": 30,
"is_print": true,
"text": "A.",
"width": 33,
"x": 231,
"y": 906
}, {
"height": 33,
"is_print": true,
"text": "B.",
"width": 30,
"x": 628,
"y": 916
}, {
"height": 34,
"is_print": true,
"text": "C.",
"width": 33,
"x": 1003,
"y": 925
}],
"text": ["2.下列图形中有两条对称轴的图形是(##B##)。", "A. B. C."]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 132,
"width": 877,
"x": 189,
"y": 978
},
"quad_location": [{
"x": 190,
"y": 977
}, {
"x": 1065,
"y": 987
}, {
"x": 1063,
"y": 1110
}, {
"x": 188,
"y": 1101
}],
"text_new": {
"singleBox": [{
"height": 52,
"is_print": true,
"text": "3.在3、4、8、9中,每两个数是互质数的有",
"width": 560,
"x": 191,
"y": 978
}, {
"height": 94,
"is_print": false,
"text": "##B##",
"width": 47,
"x": 755,
"y": 984
}, {
"height": 36,
"is_print": true,
"text": ")对。",
"width": 66,
"x": 808,
"y": 995
}, {
"height": 33,
"is_print": true,
"text": "A. 3",
"width": 63,
"x": 226,
"y": 1046
}, {
"height": 33,
"is_print": true,
"text": "B. 4",
"width": 53,
"x": 622,
"y": 1055
}, {
"height": 33,
"is_print": true,
"text": "C. 6",
"width": 56,
"x": 994,
"y": 1065
}],
"text": ["3.在3、4、8、9中,每两个数是互质数的有##B##)对。", "A. 3 B. 4 C. 6"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 189,
"width": 973,
"x": 186,
"y": 1111
},
"quad_location": [{
"x": 188,
"y": 1108
}, {
"x": 1157,
"y": 1120
}, {
"x": 1155,
"y": 1299
}, {
"x": 185,
"y": 1288
}],
"text_new": {
"singleBox": [{
"height": 77,
"is_print": true,
"text": "4.一张红纸的$$ \frac{3}{4} $$ 和一张白纸的$$ \frac{3}{5} $$ 相比较,",
"width": 547,
"x": 193,
"y": 1109
}, {
"height": 61,
"is_print": true,
"text": "$$ \frac{3}{4} $$",
"width": 26,
"x": 383,
"y": 1115
}, {
"height": 61,
"is_print": true,
"text": "$$ \frac{3}{5} $$",
"width": 25,
"x": 593,
"y": 1122
}, {
"height": 79,
"is_print": false,
"text": "##A##",
"width": 58,
"x": 740,
"y": 1130
}, {
"height": 33,
"is_print": true,
"text": ")",
"width": 30,
"x": 799,
"y": 1142
}, {
"height": 68,
"is_print": true,
"text": "A.红纸的$$ \frac{3}{4} $$ 大",
"width": 194,
"x": 223,
"y": 1212
}, {
"height": 60,
"is_print": true,
"text": "$$ \frac{3}{4} $$",
"width": 28,
"x": 356,
"y": 1217
}, {
"height": 69,
"is_print": true,
"text": "B. 白纸的$$ \frac{3}{5} $$ 大",
"width": 191,
"x": 610,
"y": 1218
}, {
"height": 56,
"is_print": true,
"text": "$$ \frac{3}{5} $$",
"width": 26,
"x": 740,
"y": 1225
}, {
"height": 50,
"is_print": true,
"text": "C.无法比较",
"width": 167,
"x": 979,
"y": 1240
}],
"text": ["4.一张红纸的$$ \frac{3}{4} $$ 和一张白纸的$$ \frac{3}{5} $$ 相比较,##A##)", "A.红纸的$$ \frac{3}{4} $$ 大 B. 白纸的$$ \frac{3}{5} $$ 大 C.无法比较"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 159,
"width": 905,
"x": 183,
"y": 1277
},
"quad_location": [{
"x": 185,
"y": 1277
}, {
"x": 1087,
"y": 1307
}, {
"x": 1082,
"y": 1435
}, {
"x": 181,
"y": 1405
}],
"text_new": {
"singleBox": [{
"height": 68,
"is_print": false,
"text": "##B##",
"width": 47,
"x": 674,
"y": 1283
}, {
"height": 47,
"is_print": true,
"text": "中,12和5是60的(",
"width": 265,
"x": 403,
"y": 1304
}, {
"height": 30,
"is_print": true,
"text": "5.在",
"width": 64,
"x": 193,
"y": 1305
}, {
"height": 30,
"is_print": true,
"text": "$$ 60\u003d12 \times 5 $$",
"width": 137,
"x": 264,
"y": 1307
}, {
"height": 31,
"is_print": true,
"text": ")",
"width": 28,
"x": 728,
"y": 1316
}, {
"height": 33,
"is_print": false,
"text": "##-7##",
"width": 34,
"x": 180,
"y": 1326
}, {
"height": 36,
"is_print": true,
"text": "A. 倍数",
"width": 104,
"x": 221,
"y": 1361
}, {
"height": 37,
"is_print": true,
"text": "B. 质数",
"width": 98,
"x": 607,
"y": 1372
}, {
"height": 44,
"is_print": true,
"text": "C.因数",
"width": 109,
"x": 968,
"y": 1385
}],
"text": ["5.在$$ 60\u003d12 \times 5 $$中,12和5是60的(##B##)", "##-7##", "A. 倍数 B. 质数 C.因数", "二、请你当裁判。(对的打“✓”,错的打“×”,共5分)"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 60,
"width": 685,
"x": 145,
"y": 1421
},
"quad_location": [{
"x": 145,
"y": 1419
}, {
"x": 829,
"y": 1432
}, {
"x": 828,
"y": 1480
}, {
"x": 144,
"y": 1468
}],
"text_new": {
"singleBox": [{
"height": 56,
"is_print": true,
"text": "二、请你当裁判。(对的打“✓”,错的打“×”,共5分)",
"width": 677,
"x": 144,
"y": 1419
}],
"text": ["二、请你当裁判。(对的打“✓”,错的打“×”,共5分)"]
},
"type": "title"
}, {
"if_insert_new": 0,
"location": {
"height": 362,
"width": 1226,
"x": 180,
"y": 1475
},
"quad_location": [{
"x": 185,
"y": 1474
}, {
"x": 1405,
"y": 1492
}, {
"x": 1399,
"y": 1836
}, {
"x": 179,
"y": 1818
}],
"text_new": {
"singleBox": [{
"height": 53,
"is_print": true,
"text": "6. 分数的分母越大,分数单位就越大。",
"width": 484,
"x": 186,
"y": 1480
}, {
"height": 31,
"is_print": true,
"text": "(",
"width": 18,
"x": 1297,
"y": 1541
}, {
"height": 30,
"is_print": true,
"text": "7",
"width": 30,
"x": 186,
"y": 1544
}, {
"height": 31,
"is_print": true,
"text": "$$ 3 \div 06\u003d $$",
"width": 136,
"x": 216,
"y": 1544
}, {
"height": 47,
"is_print": true,
"text": ",所以3是0.6的倍数。",
"width": 299,
"x": 354,
"y": 1549
}, {
"height": 30,
"is_print": true,
"text": ")",
"width": 18,
"x": 1373,
"y": 1552
}, {
"height": 47,
"is_print": false,
"text": "##×##",
"width": 34,
"x": 1326,
"y": 1555
}, {
"height": 58,
"is_print": true,
"text": "8.两个梯形可以拼成一个平行四边形。",
"width": 495,
"x": 182,
"y": 1603
}, {
"height": 45,
"is_print": false,
"text": "##×##",
"width": 31,
"x": 1324,
"y": 1608
}, {
"height": 28,
"is_print": true,
"text": "(",
"width": 14,
"x": 1294,
"y": 1609
}, {
"height": 33,
"is_print": true,
"text": ")",
"width": 18,
"x": 1369,
"y": 1612
}, {
"height": 50,
"is_print": true,
"text": "$$ 2.41 \div 2\u003d1.2 \cdots \cdots 1 $$",
"width": 265,
"x": 210,
"y": 1663
}, {
"height": 26,
"is_print": true,
"text": "9",
"width": 25,
"x": 186,
"y": 1666
}, {
"height": 28,
"is_print": true,
"text": "(",
"width": 12,
"x": 1291,
"y": 1677
}, {
"height": 45,
"is_print": false,
"text": "##×##",
"width": 41,
"x": 1307,
"y": 1679
}, {
"height": 31,
"is_print": true,
"text": ")",
"width": 15,
"x": 1367,
"y": 1681
}, {
"height": 90,
"is_print": true,
"text": "10. 同底等高的三角形形状不一定相同,但面积一定相等。",
"width": 726,
"x": 183,
"y": 1717
}, {
"height": 50,
"is_print": false,
"text": "##✓##",
"width": 72,
"x": 1315,
"y": 1725
}, {
"height": 30,
"is_print": true,
"text": "(",
"width": 15,
"x": 1285,
"y": 1742
}, {
"height": 25,
"is_print": true,
"text": ")",
"width": 14,
"x": 1364,
"y": 1749
}, {
"height": 74,
"is_print": false,
"text": "##✓##",
"width": 110,
"x": 1302,
"y": 1768
}, {
"height": 75,
"is_print": true,
"text": "三、认真思考,填上正确的答案。(共26分)",
"width": 554,
"x": 132,
"y": 1777
}, {
"height": 28,
"is_print": true,
"text": "(",
"width": 15,
"x": 1280,
"y": 1802
}, {
"height": 28,
"is_print": true,
"text": ")",
"width": 15,
"x": 1358,
"y": 1807
}],
"text": ["6. 分数的分母越大,分数单位就越大。", "7$$ 3 \div 06\u003d $$,所以3是0.6的倍数。 (##×##)", "8.两个梯形可以拼成一个平行四边形。", "(##×##)", "9$$ 2.41 \div 2\u003d1.2 \cdots \cdots 1 $$ (##×## )", "(##✓##", ")", "10. 同底等高的三角形形状不一定相同,但面积一定相等。 )", "三、认真思考,填上正确的答案。(共26分) (##✓##"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 53,
"width": 480,
"x": 193,
"y": 1483
},
"quad_location": [{
"x": 193,
"y": 1482
}, {
"x": 672,
"y": 1486
}, {
"x": 671,
"y": 1535
}, {
"x": 193,
"y": 1532
}],
"text_new": {
"singleBox": [{
"height": 53,
"is_print": true,
"text": "6. 分数的分母越大,分数单位就越大。",
"width": 484,
"x": 186,
"y": 1480
}],
"text": ["6. 分数的分母越大,分数单位就越大。"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 56,
"width": 1209,
"x": 189,
"y": 1546
},
"quad_location": [{
"x": 189,
"y": 1546
}, {
"x": 1396,
"y": 1546
}, {
"x": 1396,
"y": 1601
}, {
"x": 189,
"y": 1601
}],
"text_new": {
"singleBox": [{
"height": 31,
"is_print": true,
"text": "(",
"width": 18,
"x": 1297,
"y": 1541
}, {
"height": 30,
"is_print": true,
"text": "7",
"width": 30,
"x": 186,
"y": 1544
}, {
"height": 31,
"is_print": true,
"text": "$$ 3 \div 06\u003d $$",
"width": 136,
"x": 216,
"y": 1544
}, {
"height": 47,
"is_print": true,
"text": ",所以3是0.6的倍数。",
"width": 299,
"x": 354,
"y": 1549
}, {
"height": 30,
"is_print": true,
"text": ")",
"width": 18,
"x": 1373,
"y": 1552
}, {
"height": 47,
"is_print": false,
"text": "##×##",
"width": 34,
"x": 1326,
"y": 1555
}],
"text": ["7$$ 3 \div 06\u003d $$,所以3是0.6的倍数。 (##×##)"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 61,
"width": 1209,
"x": 186,
"y": 1606
},
"quad_location": [{
"x": 186,
"y": 1606
}, {
"x": 1394,
"y": 1606
}, {
"x": 1394,
"y": 1666
}, {
"x": 186,
"y": 1666
}],
"text_new": {
"singleBox": [{
"height": 58,
"is_print": true,
"text": "8.两个梯形可以拼成一个平行四边形。",
"width": 495,
"x": 182,
"y": 1603
}, {
"height": 45,
"is_print": false,
"text": "##×##",
"width": 31,
"x": 1324,
"y": 1608
}, {
"height": 28,
"is_print": true,
"text": "(",
"width": 14,
"x": 1294,
"y": 1609
}, {
"height": 33,
"is_print": true,
"text": ")",
"width": 18,
"x": 1369,
"y": 1612
}],
"text": ["8.两个梯形可以拼成一个平行四边形。", "(##×##)"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 60,
"width": 1204,
"x": 186,
"y": 1666
},
"quad_location": [{
"x": 186,
"y": 1665
}, {
"x": 1388,
"y": 1671
}, {
"x": 1388,
"y": 1725
}, {
"x": 186,
"y": 1720
}],
"text_new": {
"singleBox": [{
"height": 50,
"is_print": true,
"text": "$$ 2.41 \div 2\u003d1.2 \cdots \cdots 1 $$",
"width": 265,
"x": 210,
"y": 1663
}, {
"height": 26,
"is_print": true,
"text": "9",
"width": 25,
"x": 186,
"y": 1666
}, {
"height": 28,
"is_print": true,
"text": "(",
"width": 12,
"x": 1291,
"y": 1677
}, {
"height": 45,
"is_print": false,
"text": "##×##",
"width": 41,
"x": 1307,
"y": 1679
}, {
"height": 31,
"is_print": true,
"text": ")",
"width": 15,
"x": 1367,
"y": 1681
}],
"text": ["9$$ 2.41 \div 2\u003d1.2 \cdots \cdots 1 $$ (##×## )"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 96,
"width": 1184,
"x": 197,
"y": 1722
},
"quad_location": [{
"x": 198,
"y": 1721
}, {
"x": 1380,
"y": 1738
}, {
"x": 1378,
"y": 1817
}, {
"x": 196,
"y": 1801
}],
"text_new": {
"singleBox": [{
"height": 90,
"is_print": true,
"text": "10. 同底等高的三角形形状不一定相同,但面积一定相等。",
"width": 726,
"x": 183,
"y": 1717
}, {
"height": 50,
"is_print": false,
"text": "##✓##",
"width": 72,
"x": 1315,
"y": 1725
}, {
"height": 30,
"is_print": true,
"text": "(",
"width": 15,
"x": 1285,
"y": 1742
}, {
"height": 25,
"is_print": true,
"text": ")",
"width": 14,
"x": 1364,
"y": 1749
}, {
"height": 28,
"is_print": true,
"text": "(",
"width": 15,
"x": 1280,
"y": 1802
}],
"text": ["(##✓##", ")", "10. 同底等高的三角形形状不一定相同,但面积一定相等。 )", "三、认真思考,填上正确的答案。(共26分) (##✓##"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 77,
"width": 558,
"x": 136,
"y": 1780
},
"quad_location": [{
"x": 138,
"y": 1779
}, {
"x": 693,
"y": 1804
}, {
"x": 690,
"y": 1858
}, {
"x": 136,
"y": 1834
}],
"text_new": {
"singleBox": [{
"height": 75,
"is_print": true,
"text": "三、认真思考,填上正确的答案。(共26分)",
"width": 554,
"x": 132,
"y": 1777
}],
"text": ["三、认真思考,填上正确的答案。(共26分) (##✓##"]
},
"type": "title"
}, {
"if_insert_new": 0,
"location": {
"height": 67,
"width": 642,
"x": 742,
"y": 1793
},
"quad_location": [{
"x": 742,
"y": 1792
}, {
"x": 1383,
"y": 1800
}, {
"x": 1382,
"y": 1859
}, {
"x": 742,
"y": 1850
}],
"text_new": {
"singleBox": [{
"height": 28,
"is_print": true,
"text": "(",
"width": 15,
"x": 1280,
"y": 1802
}, {
"height": 28,
"is_print": true,
"text": ")",
"width": 15,
"x": 1358,
"y": 1807
}],
"text": ["三、认真思考,填上正确的答案。(共26分) (##✓##"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 109,
"width": 807,
"x": 175,
"y": 1834
},
"quad_location": [{
"x": 178,
"y": 1833
}, {
"x": 981,
"y": 1878
}, {
"x": 977,
"y": 1942
}, {
"x": 174,
"y": 1897
}],
"text_new": {
"singleBox": [{
"height": 91,
"is_print": true,
"text": "11. 它是一个三位数,同时是2,3和5的倍数,它最小是",
"width": 694,
"x": 178,
"y": 1834
}, {
"height": 52,
"is_print": false,
"text": "##12##",
"width": 60,
"x": 869,
"y": 1886
}, {
"height": 26,
"is_print": true,
"text": ")",
"width": 28,
"x": 941,
"y": 1897
}, {
"height": 75,
"is_print": true,
"text": "12. 在0~10中,既不是合数,也不是质数的是(",
"width": 573,
"x": 193,
"y": 1897
}],
"text": ["11. 它是一个三位数,同时是2,3和5的倍数,它最小是##12##)", "12. 在0~10中,既不是合数,也不是质数的是( ##0## ),既是奇数,又是合数的是( ##3## ),图"]
},
"type": "text"
}, {
"if_insert_new": 0,
"location": {
"height": 199,
"width": 1204,
"x": 169,
"y": 1907
},
"quad_location": [{
"x": 169,
"y": 1907
}, {
"x": 1372,
"y": 1907
}, {
"x": 1372,
"y": 2105
}, {
"x": 169,
"y": 2105
}],
"text_new": {
"singleBox": [{
"height": 52,
"is_print": false,
"text": "##12##",
"width": 60,
"x": 869,
"y": 1886
}, {
"height": 26,
"is_print": true,
"text": ")",
"width": 28,
"x": 941,
"y": 1897
}, {
"height": 75,
"is_print": true,
"text": "12. 在0~10中,既不是合数,也不是质数的是(",
"width": 573,
"x": 193,
"y": 1897
}, {
"height": 55,
"is_print": true,
"text": "),既是奇数,又是合数的是(",
"width": 354,
"x": 851,
"y": 1940
}, {
"height": 34,
"is_print": false,
"text": "##0##",
"width": 28,
"x": 791,
"y": 1943
}, {
"height": 69,
"is_print": false,
"text": "##3##",
"width": 41,
"x": 1223,
"y": 1950
}, {
"height": 44,
"is_print": true,
"text": "是偶数,又是质数的是(",
"width": 297,
"x": 220,
"y": 1964
}, {
"height": 36,
"is_print": true,
"text": "),图",
"width": 60,
"x": 1296,
"y": 1970
}, {
"height": 37,
"is_print": false,
"text": "##1##",
"width": 20,
"x": 527,
"y": 1972
}, {
"height": 28,
"is_print": true,
"text": ")",
"width": 28,
"x": 601,
"y": 1983
}, {
"height": 91,
"is_print": true,
"text": "$$ \frac{(9)}{7}\u003d3 \frac{2}{7} $$",
"width": 178,
"x": 457,
"y": 2010
}, {
"height": 72,
"is_print": true,
"text": "$$ 1 \frac{5}{6}\u003d \frac{(10)}{6} $$",
"width": 180,
"x": 212,
"y": 2024
}, {
"height": 58,
"is_print": true,
"text": "1½{5}{27}-",
"width": 77,
"x": 218,
"y": 2035
}, {
"height": 68,
"is_print": true,
"text": "$$ 4\u003d \frac{(4)}{5} $$",
"width": 136,
"x": 731,
"y": 2037
}, {
"height": 52,
"is_print": true,
"text": "$$ \frac{17}{9}-5(6) $$",
"width": 175,
"x": 1000,
"y": 2057
}, {
"height": 47,
"is_print": true,
"text": "17-5",
"width": 80,
"x": 1003,
"y": 2060
}, {
"height": 39,
"is_print": false,
"text": "##6##",
"width": 28,
"x": 1114,
"y": 2064
}],
"text": ["12. 在0~10中,既不是合数,也不是质数的是( ##0## ),既是奇数,又是合数的是( ##3## ),图", "是偶数,又是质数的是(##1## )", "$$ 1 \frac{5}{6}\u003d \frac{(10)}{6} \frac{(9)}{7}\u003d3 \frac{2}{7} 4\u003d \frac{(4)}{5} \frac{17}{9}-5(6) $$", "1½{5}{27}- 17-5 ##6##"]
},
"type": "text"
}]
],
"rotate_angle": 0
}],
"result_num": 1
}
请求示例
val config = PageSplitConfig.Builder()
config.setImage(image)
.setIfReg(binding.tvReg.isChecked)
.setIfMath(binding.tvMath.isChecked)
.setFunction(binding.tvFunction.isChecked)
turingIrt.examPageSplit(config.build(), object : TuringListener<PageSplitData> {
override fun onError(code: Int, message: String?) {
Log.e(TAG, "onError code:$code message:$message")
}
override fun onSuccess(result: PageSplitData?) {
// 试卷分析请求成功
result?.let{
runOnUiThread{
// 业务处理
}
}
})
}
9. 弯曲矫正
对于扭曲的文字,比如环形标志中的文字、弯曲的文档、弯曲的证件等等,通过图片识别并进行矫正技术。
方法
void imageCorrection(IRTConfig config,TuringListener<ImgCorrectData> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 注:最大支持图片为1M,宽高必须大于30px,小于1080p。 |
IRTConfig#image规则说明,同【整题识别中规则说明】。
输出说明
ImgCorrectData 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| imageId | String | 矫正后的图片ID,可用于试卷分析 |
| correctionUrl | String | 矫正后的图片Url |
请求示例
val builder = IRTConfig.Builder();
Log.e(TAG, "startQuestionOcr(imageData)")
builder.setImage(imageData)
turingIrt.imageCorrection(builder.build(), correctListener)
private val correctListener = object : TuringListener<ImgCorrectData> {
override fun onSuccess(result: ImgCorrectData?) {
dismissProgress()
runOnUiThread {
result?.let {
showMessage("图片ID:" + result.imageId)
}
showToast("3秒后跳转到试卷拆录")
mUIHandler.postDelayed({
val intent = Intent(this@IrtActivity, ExamPageSplitActivity::class.java)
intent.putExtra("imageId", result?.imageId)
intent.putExtra("imageUrl", result?.correctionUrl)
startActivity(intent)
}, 3000)
}
}
override fun onError(code: Int, message: String?) {
dismissProgress()
runOnUiThread {
showToast("errorCode:$code msg:$message")
}
}
}
10 版面分析
方法
void layoutParse(IRTConfig config, TuringListener<LayoutParseBean> listener);
输入说明
IRTConfig 说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| image | byte[] | N | 图片数据 |
IRTConfig#image规则说明,同【整题识别中规则说明】。
输出说明
LayoutParseBean 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| details | List\ |
段落框详情 |
Detail 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| corners | double[] | 段落框 值说明:[左上xy, 右上xy, 右下xy, 左下xy] |
| confidence | double | 置信度 |
| lable | String | 类别 |
| labelIndex | int | 类别id |
请求示例
val builder = IRTConfig.Builder();
builder.setImage(imageData)
turingIrt.layoutParse(builder.build(), correctListener)
private val correctListener = object : TuringListener<LayoutParseBean> {
override fun onSuccess(result: LayoutParseBean?) {
}
override fun onError(code: Int, message: String?) {
}
}
11 字错率
方法
List<RecognizeResultEntity> alignListOfString(String ref, List<String> hypList);
输入说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| ref | String | Y | 原文 |
| hypList | List\ |
Y | 目标文本列表 |
输出说明
RecognizeResultEntity 说明
| 参数 | 类型 | 说明 |
|---|---|---|
| cer | float | 错字率 |
| errNum | int | 错误字数 |
| chnErr | int | 错误的中文字数 |
| chnWord | int | 中文字数 |
| chnSub | int | 匹配错误的中文字数 |
| chnDel | int | 删除的中文字数 |
| chnIns | int | 新增的中文字数 |
| engErr | int | 错误的英文字数 |
| engWord | int | 英文字数 |
| engSub | int | 匹配错误的英文字数 |
| engDel | int | 删除的英文字数 |
| engIns | int | 新增的英文字数 |
请求示例
var str = "[跨学科·物理与生活(2022山东寿光期末,10、★☆☆)如图所示,这是一种常用的核桃夹,用大小相同的力垂直作用在B点比A点更容易夹碎核桃,这说明影响力的作用效果的因素是()ABA. 力的大小 B.力的方向C. 力的作用点 D. 施力物体"
val stringList: List<String> = getThreeHyps()
val list: List<RecognizeResultEntity> =
TuringIrt.getInstance(this).alignListOfString(str, stringList)
if (list != null && list.size > 0) {
for (resultEntity in list) {
Log.i(TAG, "错字率:" + resultEntity.getCer())
Log.e(TAG,resultEntity.toString())
}
}
fun getThreeHyps(): List<String> {
val list: MutableList<String> = ArrayList()
list.add("如图所示,这是一种常用的核桃夹,用大小相同的力垂直作用在B点比A点更容易夹碎核桃,这说明影响力的作用效果的因素是( )A.力的大小B.力的方向C.力的作用点D.施力物体")
list.add("如图所示为一种常用核桃夹,用大小相同的力垂直作用在B点比A点更容易夹碎核桃,这说明力的作用效果与()A.力的大小有关B.力的方向有关C.力的作用点有关D.受力面积有关")
list.add("如图所示为一种常用核桃夹,用大小相同的力垂直作用在B点比A点更容易夹碎核桃,这说明力的作用效果与()A.力的大小有关B.力的方向有关C.力的作用点有关D.受力面积有关")
return list
}