商务合作联系微信:telegram: @tianmeiapp
站长邮箱:[email protected]
简介
本文档提供了通用文本识别的 API 概述和 SDK 示例代码。
API 说明
通用文本识别
通用字符识别功能(识别视频声音生成文字的软件,OCR)基于业界前沿的深度学习技术,智能识别图片上的文字内容为可编辑文字,可用于随机扫描、电子纸质文档、电子纸质文档等。 - 商业广告。审计等场景大大提高了信息处理的效率。
一般文字识别功能说明
通用文本识别。
方法原型
func (s *CIService) OcrRecognition(ctx context.Context, key string, opt *OcrRecognitionOptions) (*OcrRecognitionResult, *Response, error)
请求示例
obj := "pic/ocr.png"
opt := &cos.OcrRecognitionOptions{
Type: "general",
LanguageType: "zh",
Isword: true,
EnableWordPolygon: true,
}
res, _, err := c.CI.OcrRecognition(context.Background(), obj, opt)
参数说明参数名称参数说明
键
对象键(Key)是桶中对象的唯一标识。例如识别视频声音生成文字的软件,在对象的访问域/pic/pic.jpg中,对象键为pic/pic.jpg
选择
通用文本识别参数
结果说明
type OcrRecognitionResult struct {
XMLName xml.Name `xml:"Response"`
TextDetections []TextDetections `xml:"TextDetections,omitempty"`
Language string `xml:"Language,omitempty"`
Angel float64 `xml:"Angel,omitempty"`
PdfPageSize int `xml:"PdfPageSize,omitempty"`
RequestId string `xml:"RequestId,omitempty"`
}
type TextDetections struct {
DetectedText string `xml:"DetectedText,omitempty"`
Confidence int `xml:"Confidence,omitempty"`
Polygon []Polygon `xml:"Polygon,omitempty"`
ItemPolygon []ItemPolygon `xml:"ItemPolygon,omitempty"`
Words []Words `xml:"Words,omitempty"`
WordPolygon []WordPolygon `xml:"WordPolygon,omitempty"`
}
type Polygon struct {
X int `xml:"X,omitempty"`
Y int `xml:"Y,omitempty"`
}
type ItemPolygon struct {
X int `xml:"X,omitempty"`
Y int `xml:"Y,omitempty"`
Width int `xml:"Width,omitempty"`
Height int `xml:"Height,omitempty"`
}
type Words struct {
Confidence int `xml:"Confidence,omitempty"`
Character string `xml:"Character,omitempty"`
WordCoordPoint *WordCoordPoint `xml:"WordCoordPoint,omitempty"`
}
type WordCoordPoint struct {
WordCoordinate []Polygon `xml:"WordCoordinate,omitempty"`
}
type WordPolygon struct {
LeftTop *Polygon `xml:"LeftTop,omitempty"`
RightTop *Polygon `xml:"RightTop,omitempty"`
RightBottom *Polygon `xml:"RightBottom,omitempty"`
LeftBottom *Polygon `xml:"LeftBottom,omitempty"`
}
商务合作联系微信:telegram: @tianmeiapp
站长邮箱:[email protected]
原文链接:API说明通用文字识别功能(SDK示例代码)-OCR,转载请注明来源!