目录

class info
com.huawei.hms.mlsdk.text.MLText.Base
文本信息的父类,表示图像检测出的基本文本信息。
包含5个属性:
1、检测出的文本内容
2、文本的边框
3、文本边框的顶点
4、检测结果的置信度
5、检测到的所有语种

Public Method Summary

Return typeMethod name
android.graphics.RectgetBorder()
List<? extends MLText.Base>getContents()
StringgetLanguage()
ListgetLanguageList()
FloatgetPossibility()
StringgetStringValue()
android.graphics.Point[]getVertexes()

Public Methods

Method
public android.graphics.Rect getBorder()
获取文本的轴对齐矩形边界框。

Return

Typedesc
android.graphics.Rect返回文本的轴对齐矩形边界框。
Method
public List<? extends MLText.Base> getContents()
获取当前文本对象包含的低一级的文本对象,当前方法需要在子类中重写。文本对象分为文本区块(Block)、文本行(TextLine)、文本元素(Word)。文本区块(Block)是最高级的文本对象,可包含多个低一级的文本行(TextLine)对象;文本行对象可包含多个最低级的文本元素(Word)对象;文本元素(Word)对象是一组字符组成的词。如果当前文本对象为最低级文本对象(Word)则返回空。

Return

Typedesc
List<? extends MLText.Base>返回当前文本对象包含的低一级的文本对象,
例如:如果当前对象是文本行(TextLine),则返回文本元素(Word)集合。
Method
public String getLanguage()
获取文本中出现次数最多的语种。

Return

Typedesc
String返回语种,语种使用语言代码表示,可能返回的语种有:
“en”(英),“zh”(中),“ja”(日),
“ko”(韩),“ru”(俄),“de”(德),
“fr”(法),“it”(意大利),“pt”(葡萄牙),
“es”(西班牙),“rm”(拉丁语系语言);
云侧接口还支持语种:
“pl”(波兰),“no”(挪威),“sv”(瑞典),
“da”(丹麦),“tr”(土耳其),“fi”(芬兰),
“th”(泰语),“ar”(阿拉伯语),“hi”(印地语)。
Method
public List<TextLanguage> getLanguageList()
获取检测出的语种。

Return

Typedesc
List<TextLanguage>返回语种列表,语种使用语言代码表示,可能返回的语种有:
“en”(英),“zh”(中),“ja”(日),“ko”(韩),
“ru”(俄),“de”(德),“fr”(法),“it”(意大利),
“pt”(葡萄牙),“es”(西班牙),“rm”(拉丁语系语言);
云侧接口还支持语种:“pl”(波兰),“no”(挪威),
“sv”(瑞典),“da”(丹麦),“tr”(土耳其),
“fi”(芬兰),“th”(泰语),“ar”(阿拉伯语),
“hi”(印地语)。
Method
public Float getPossibility()
获取检测结果置信度。

Return

Typedesc
Float返回置信度,取值范围0.0-1.0,置信度越高说明检测结果越准确。仅在云端检测的情况下返回置信度信息。
Method
public String getStringValue()
获取检测到的文本内容。

Return

Typedesc
String返回文本内容。
Method
public android.graphics.Point[] getVertexes()
获取文本边框的顶点。

Return

Typedesc
android.graphics.Point[]返回文本边框的顶点,返回的数组中第一个点对应文本边框的左上角的顶点,
顶点按顺时针顺序排列。