baiduai

package
v0.0.0-...-2ec961a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaiDuAI

type BaiDuAI struct {
	AppId       string
	AppKey      string
	SecretKey   string
	AccessToken string

	OcrResult *OcrReturn
	IorcIn    *IocrInput
	// contains filtered or unexported fields
}

func NewBaiDuAI

func NewBaiDuAI(appid, appkey, seckey string) *BaiDuAI

func (*BaiDuAI) GetAccessToken

func (this *BaiDuAI) GetAccessToken()

func (*BaiDuAI) IocrNewInput

func (this *BaiDuAI) IocrNewInput()

func (*BaiDuAI) IocrRecogniseFinance

func (this *BaiDuAI) IocrRecogniseFinance() bool

func (*BaiDuAI) OcrReceipt

func (this *BaiDuAI) OcrReceipt() bool

func (*BaiDuAI) SetImage

func (this *BaiDuAI) SetImage(img_path string) *BaiDuAI

func (*BaiDuAI) StructInit

func (this *BaiDuAI) StructInit()

type CharResult

type CharResult struct {
	Location OcrLocation `json:"location"` // location	是	object{}	位置数组(坐标0点为左上角)
	Char     string      `json:"char"`     //words	是	string	识别结果字符串
}

type IocrInput

type IocrInput struct {
	Image    string `json:"image"`                  //image	true	string	-	图像数据,base64编码后进行urlencode,要求base64编码和urlencode后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/jpeg/png/bmp格式
	Template string `json:"templateSign,omitempty"` //false	string	-	自定义模板的ID,举例:Nsdax2424asaAS791823112
	Dectid   int    `json:"detectorId,omitempty"`   //"	false	int	0	检测器ID,可选值仅有0。detectorId = 0时,启用混贴票据识别功能,可对发票粘贴单上的多张不同种类票据进行分类检测和识别
	ClassId  int    `json:"classifierId"`           //"	false	int	-	分类器Id,用于指定使用哪个分类器。
}

type IocrJsonObject

type IocrJsonObject struct {
}

type IocrRF

type IocrRF struct {
	ErrorCode int    `json:"error_code"` //error_code	int	0代表成功,如果有错误码返回可以参考下方错误码列表排查问题
	ErrorMsg  string `json:"error_msg"`  //error_msg	string	如果error_code具体的失败信息,可以参考下方错误码列表排查问题
	LogId     string `json:"logId"`      //logId	string	调用的日志id
	// contains filtered or unexported fields
}

type OcrLocation

type OcrLocation struct {
	Left   uint32 `json:"left"`   //left	是	uint32	表示定位位置的长方形左上顶点的水平坐标
	Top    uint32 `json:"top"`    //top	是	uint32	表示定位位置的长方形左上顶点的垂直坐标
	Width  uint32 `json:"width"`  //width	是	uint32	表示定位位置的长方形的宽度
	Heigth uint32 `json:"heigth"` //height	是	uint32	表示定位位置的长方形的高度
}

type OcrReturn

type OcrReturn struct {
	LogId          uint64       `json:"log_id"`           //	log_id	是	uint64	唯一的log id,用于问题定位
	WordsResultNum uint32       `json:"words_result_num"` //words_result_num	是	uint32	识别结果数,表示words_result的元素个数
	WordsResult    []WordReulst `json:"words_result"`     //words_result	是	array[]	定位和识别结果数组
	Chars          []CharResult `json:"chars"`            //chars	否	array[]	单字符结果,recognize_granularity=small时存在
	Probability    float32      `json:"probability"`      //probability	否	float	识别结果中每一行的置信度值,包含average:行置信度平均值,variance:行置信度方差,min:行置信度最小值
}

type WordReulst

type WordReulst struct {
	Location OcrLocation `json:"location"` // location	是	object{}	位置数组(坐标0点为左上角)
	Words    string      `json:"words"`    //words	是	string	识别结果字符串
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL