api_baidu

package
v1.2.37 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetAccessTokenUrl = "https://aip.baidubce.com/oauth/2.0/token"
View Source
var OcrAccurateBasicUrl = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic"

Functions

func GetImage64ByFile

func GetImage64ByFile(filePath string) (base64Str string, err error)

Types

type GetAccessTokenResponse

type GetAccessTokenResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

func GetAccessToken

func GetAccessToken(apiKey string, secretKey string) (res *GetAccessTokenResponse, err error)

type OcrAccurateBasicResponse

type OcrAccurateBasicResponse struct {
	LogId          uint64   `json:"log_id"`           // 唯一的log id,用于问题定位
	Direction      int32    `json:"direction"`        // 图像方向,当 detect_direction=true 时返回该字段。 - 1:未定义, 0:正向, 1:逆时针90度, 2:逆时针180度, 3:逆时针270度
	WordsResultNum uint32   `json:"words_result_num"` // 识别结果数,表示words_result的元素个数
	WordsResult    []*Words `json:"words_result"`     //识别结果数组
}

func OcrAccurateBasicImage

func OcrAccurateBasicImage(accessToken string, imageBase64 string) (res *OcrAccurateBasicResponse, err error)

func OcrAccurateBasicImageByFile

func OcrAccurateBasicImageByFile(accessToken string, filePath string) (res *OcrAccurateBasicResponse, err error)

type Words

type Words struct {
	Words string `json:"words"` // 识别结果字符串
}

Jump to

Keyboard shortcuts

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