libs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	XunfeihostUrl   = ""
	XunfeiapiKey    = ""
	XunfeiapiSecret = ""
	Xunfeiappid     = ""
)

科大讯飞必要的配置信息

View Source
var AliKey string = ""

阿里的KET和SERET

View Source
var AliKeySecret string = ""
View Source
var BaiduFaceVerifyKey string = ""

人脸对比

View Source
var BaiduFaceVerifyKeySecret string = ""
View Source
var BaiduImgSplitKey string = ""

人像分割

View Source
var BaiduImgSplitKeySecret string = ""
View Source
var FaceVerifyServerInfo string = ""

定义的服务器错误信息

View Source
var ImgSplitServerErr = ""

定义的服务器错误信息

View Source
var Loopcount int = 0

主程序内记录服务器使用次数

View Source
var TencentKey string = ""

腾讯的KEY和SECRET

View Source
var TencentKeySecret string = ""

Functions

func AddNum

func AddNum(num int, loop int) int

func AliImgSplit

func AliImgSplit(picPath string) (string, error)

func BaiduImgSplit

func BaiduImgSplit(picPath string) (string, error)

func DeCodeBase64

func DeCodeBase64(data string, savePath string)

func GetAccessToken

func GetAccessToken(id, secret string) (string, error)

百度

func GetFilePath

func GetFilePath(imgPath string) (file1Path string)

阿里云

func HmacWithShaTobase64

func HmacWithShaTobase64(algorithm, data, key string) string

func ImageSplit

func ImageSplit(firstSplitImage int, urlPath string) (newImgBase64, serverInfo string, err error)

分割图片的函数,需要传入服务器优先顺序:firstSplitImage,原始图片路径:urlPath

func Pic2Base64

func Pic2Base64(url string) string

func TencentImgSplit

func TencentImgSplit(picPath string) (string, error)

Types

type BaiduRequest

type BaiduRequest struct {
	Image           string `json:"image"`
	ImageType       string `json:"image_type"`
	FaceType        string `json:"face_type"`
	QualityControl  string `json:"quality_control"`
	LivenessControl string `json:"liveness_control"`
}

百度

func GetBaiduBody

func GetBaiduBody(img1path, img2path string) []BaiduRequest

type BodyRequest

type BodyRequest struct {
	Header    Header    `json:"header"`
	Parameter Parameter `json:"parameter"`
	Payload   Payload   `json:"payload"`
}

func GetXunfeiBody

func GetXunfeiBody(img1path, img2path string) BodyRequest

type BodyReturn

type BodyReturn struct {
	Header  HeaderReturn  `json:"header"`
	Payload PayloadReturn `json:"payload"`
}

type FaceCompareResult

type FaceCompareResult struct {
	EnCoding string `json:"encoding"`
	Compress string `json:"compress"`
	Format   string `json:"format"`
}

type FaceCompareResultReturn

type FaceCompareResultReturn struct {
	Compress string `json:"compress"`
	Encoding string `json:"encoding"`
	Format   string `json:"format"`
	Text     string `json:"text"`
}

type FaceVerify

type FaceVerify struct {
	Faceimg1 string
	Faceimg2 string
}

func (*FaceVerify) AliCheckFace

func (f *FaceVerify) AliCheckFace(img1path, img2path string) (float64, error)

func (*FaceVerify) BaiduCheckFace

func (f *FaceVerify) BaiduCheckFace(img1path, img2path string) (float64, error)

func (*FaceVerify) CheckFace

func (f *FaceVerify) CheckFace(firstSplitImage int, url1Path, url2Path string) (result float64, serverInfo string, err error)

输入服务器使用优先顺序、对比图片1的原始路径、对比图片2的原始路径,输出结果和错误信息 返回人脸对比结果、各服务器错误信息、函数执行错误信息。

func (*FaceVerify) TenCheckFace

func (f *FaceVerify) TenCheckFace(img1path, img2path string) (float64, error)

func (*FaceVerify) XunfeiCheckFace

func (f *FaceVerify) XunfeiCheckFace(img1path, img2path string) (float64, error)
type Header struct {
	AppId  string `json:"app_id"`
	Status int    `json:"status"`
}

type HeaderReturn

type HeaderReturn struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Sid     string `json:"sid"`
}

type Input

type Input struct {
	EnCoding string `json:"encoding"`
	Status   int    `json:"status"`
	Image    string `json:"image"`
}

科大讯飞

type Parameter

type Parameter struct {
	S67c9c78c S67c9c78c `json:"s67c9c78c"`
}

type Payload

type Payload struct {
	Input1 Input `json:"input1"`
	Input2 Input `json:"input2"`
}

type PayloadReturn

type PayloadReturn struct {
	FaceCompareResultReturn FaceCompareResultReturn `json:"face_compare_result"`
}

type S67c9c78c

type S67c9c78c struct {
	ServiceKind       string            `json:"service_kind"`
	FaceCompareResult FaceCompareResult `json:"face_compare_result"`
}

type Text

type Text struct {
	Ret   int     `json:"ret"`
	Score float64 `json:"score"`
}

Jump to

Keyboard shortcuts

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