Documentation ¶
Index ¶
- Constants
- func Activation(appId, sdkKey string) (err error)
- func DecodeImage(filePath string) (img image.Image, err error)
- func GetImageHeight(img image.Image) int
- func GetImageWidth(img image.Image) int
- func GetImageWidthAndHeight(filename string) (width, height int)
- func New3DSlice(x int, y int, z int) (theSlice [][][]uint8)
- func NewRGBAMatrix(height int, width int) (rgbaMatrix [][][]uint8)
- func OnlineActivation(appId, sdkKey string) (err error)
- func Resize(src *image.NRGBA, width int, height int) *image.NRGBA
- func ResizeForMatrix(img image.Image, width int, height int) (imgMatrix [][][]uint8, err error)
- type ActiveFileInfo
- type AgeInfo
- type EngineError
- type Face3DAngle
- type FaceEngine
- func (engine *FaceEngine) Destroy() error
- func (engine *FaceEngine) DetectFaces(width, height int, format C.MInt32, imgData []byte) (faceInfo MultiFaceInfo, err error)
- func (engine *FaceEngine) DetectFacesEx(imageData ImageData) (faceInfo MultiFaceInfo, err error)
- func (engine *FaceEngine) FaceFeatureCompare(feature1, feature2 FaceFeature) (float32, error)
- func (engine *FaceEngine) FaceFeatureExtract(width, height int, format C.MInt32, imgData []byte, faceInfo SingleFaceInfo) (faceFeature FaceFeature, err error)
- func (engine *FaceEngine) FaceFeatureExtractEx(imageData ImageData, faceInfo SingleFaceInfo) (feature FaceFeature, err error)
- func (engine *FaceEngine) GetAge() (AgeInfo, error)
- func (engine *FaceEngine) GetFace3DAngle() (Face3DAngle, error)
- func (engine *FaceEngine) GetGender() (GenderInfo, error)
- func (engine *FaceEngine) GetLivenessScore() (LivenessInfo, error)
- func (engine *FaceEngine) GetLivenessScoreIR() (LivenessInfo, error)
- func (engine *FaceEngine) GetVersion() Version
- func (engine *FaceEngine) Process(width, height int, format C.MInt32, imgData []byte, ...) error
- func (engine *FaceEngine) ProcessEx(imageData ImageData, faceInfo MultiFaceInfo, combinedMask C.MInt32) error
- func (engine *FaceEngine) ProcessIR(width, height int, format C.MInt32, imgData []byte, ...) error
- func (engine *FaceEngine) SetLivenessParam(threshold LivenessThreshold) error
- type FaceFeature
- type GenderInfo
- type ImageData
- type ImageInfo
- type LivenessInfo
- type LivenessThreshold
- type MultiFaceInfo
- type Rect
- type SingleFaceInfo
- type Version
Constants ¶
const ( DetectModeVideo = C.ASF_DETECT_MODE_VIDEO DetectModeImage = C.ASF_DETECT_MODE_IMAGE OrientPriority0 = C.ASF_OP_0_ONLY OrientPriority90 = C.ASF_OP_90_ONLY OrientPriority270 = C.ASF_OP_270_ONLY OrientPriority180 = C.ASF_OP_180_ONLY OrientPriorityAllOut = C.ASF_OP_ALL_OUT EnableNone = C.ASF_NONE EnableFaceDetect = C.ASF_FACE_DETECT EnableFaceRecognition = C.ASF_FACERECOGNITION EnableAge = C.ASF_AGE EnableGender = C.ASF_GENDER EnableFace3DAngle = C.ASF_FACE3DANGLE EnableLiveness = C.ASF_LIVENESS EnableIRLiveness = C.ASF_IR_LIVENESS ColorFormatBGR24 = C.ASVL_PAF_RGB24_B8G8R8 ColorFormatNV12 = C.ASVL_PAF_NV12 ColorFormatNV21 = C.ASVL_PAF_NV21 ColorFormatI420 = C.ASVL_PAF_I420 ColorFormatYUYV = C.ASVL_PAF_YUYV )
Variables ¶
This section is empty.
Functions ¶
func Activation ¶
Activation 在线激活接口,该接口与ASFOnlineActivation接口功能一致,推荐使用该接口
func DecodeImage ¶
DecodeImage decode a image and retrun golang image interface
func GetImageWidthAndHeight ¶
GetImageWidthAndHeight 获取图片宽高
func NewRGBAMatrix ¶
NewRGBAMatrix create a new rgba matrix
func OnlineActivation ¶
OnlineActivation 在线激活接口
Types ¶
type ActiveFileInfo ¶
type ActiveFileInfo struct { StartTime string //开始时间 EndTime string //截止时间 Platform string //平台 SdkType string //sdk类型 AppId string //APPID SdkKey string //SDKKEY SdkVersion string //SDK版本号 FileVersion string //激活文件版本号 }
ActiveFileInfo 激活文件信息结构体
func GetActiveFileInfo ¶
func GetActiveFileInfo() (ActiveFileInfo, error)
GetActiveFileInfo 获取激活文件信息接口
type EngineError ¶
EngineError SDK错误码
type Face3DAngle ¶
type Face3DAngle struct { Roll []float32 Yaw []float32 Pitch []float32 Status []int32 // 0: 正常,其他数值:出错 Num int32 }
Face3DAngle 人脸3D角度信息结构体
type FaceEngine ¶
type FaceEngine struct {
// contains filtered or unexported fields
}
FaceEngine 引擎结构体
func NewFaceEngine ¶
func NewFaceEngine(dm, op uint32, faceScale, maxFaceNum, combinedMask C.MInt32) (*FaceEngine, error)
NewFaceEngine 创建一个新的引擎实例
如果调用初始化函数失败则返回一个错误
func (*FaceEngine) DetectFaces ¶
func (engine *FaceEngine) DetectFaces(width, height int, format C.MInt32, imgData []byte) (faceInfo MultiFaceInfo, err error)
DetectFaces 人脸检测,目前不支持IR图像数据检测
func (*FaceEngine) DetectFacesEx ¶
func (engine *FaceEngine) DetectFacesEx(imageData ImageData) (faceInfo MultiFaceInfo, err error)
DetectFacesEx 检测人脸信息
该接口与 DetectFaces 功能一致,但采用结构体的形式传入图像数据,对更高精度的图像兼容性更好。
func (*FaceEngine) FaceFeatureCompare ¶
func (engine *FaceEngine) FaceFeatureCompare(feature1, feature2 FaceFeature) (float32, error)
FaceFeatureCompare 人脸特征比对
func (*FaceEngine) FaceFeatureExtract ¶
func (engine *FaceEngine) FaceFeatureExtract(width, height int, format C.MInt32, imgData []byte, faceInfo SingleFaceInfo) (faceFeature FaceFeature, err error)
FaceFeatureExtract 单人脸特征提取
func (*FaceEngine) FaceFeatureExtractEx ¶
func (engine *FaceEngine) FaceFeatureExtractEx( imageData ImageData, faceInfo SingleFaceInfo, ) (feature FaceFeature, err error)
FaceFeatureExtractEx 单人脸特征提取
该接口与 ASFFaceFeatureExtract 功能一致,但采用结构体的形式传入图像数据,对更高精度的图像兼容性更好
func (*FaceEngine) GetFace3DAngle ¶
func (engine *FaceEngine) GetFace3DAngle() (Face3DAngle, error)
GetFace3DAngle 获取3D角度信息
func (*FaceEngine) GetGender ¶
func (engine *FaceEngine) GetGender() (GenderInfo, error)
GetGender 获取性别信息
func (*FaceEngine) GetLivenessScore ¶
func (engine *FaceEngine) GetLivenessScore() (LivenessInfo, error)
GetLivenessScore 获取RGB活体结果
func (*FaceEngine) GetLivenessScoreIR ¶
func (engine *FaceEngine) GetLivenessScoreIR() (LivenessInfo, error)
GetLivenessScoreIR 获取IR活体结果
func (*FaceEngine) Process ¶
func (engine *FaceEngine) Process(width, height int, format C.MInt32, imgData []byte, detectedFaces MultiFaceInfo, combinedMask C.MInt32) error
Process 年龄/性别/人脸3D角度(该接口仅支持RGB图像),最多支持4张人脸信息检测,超过部分返回未知 RGB活体仅支持单人脸检测,该接口不支持检测IR活体
func (*FaceEngine) ProcessEx ¶
func (engine *FaceEngine) ProcessEx(imageData ImageData, faceInfo MultiFaceInfo, combinedMask C.MInt32) error
ProcessEx 人脸信息检测(年龄/性别/人脸3D角度),最多支持4张人脸信息检测,超过部分返回未知(活体仅支持单张人脸检测,超出返回未知),接口仅支持可见光图像检测
该接口与 Process 功能一致,但采用结构体的形式传入图像数据,对更高精度的图像兼容性更好
func (*FaceEngine) ProcessIR ¶
func (engine *FaceEngine) ProcessIR(width, height int, format C.MInt32, imgData []byte, detectedFaces MultiFaceInfo, combinedMask C.MInt32) error
ProcessIR 该接口目前仅支持单人脸IR活体检测(不支持年龄、性别、3D角度的检测),默认取第一张人脸
func (*FaceEngine) SetLivenessParam ¶
func (engine *FaceEngine) SetLivenessParam(threshold LivenessThreshold) error
SetLivenessParam 设置活体置信度
取值范围[0-1]内部默认数值RGB-0.75,IR-0.7, 用户可以根据实际需求,设置不同的阈值
type FaceFeature ¶
type FaceFeature struct { Feature []byte // 人脸特征信息 FeatureSize int32 // 人脸特征信息长度 // contains filtered or unexported fields }
FaceFeature 人脸特征结构体
func ReadFaceFeatureFromBytes ¶
func ReadFaceFeatureFromBytes(bytes []byte) (feature FaceFeature)
ReadFaceFeatureFromBytes 将字节数据转为人脸特征数据
type GenderInfo ¶
type GenderInfo struct { GenderArray []int32 // "0" 表示 男性, "1" 表示 女性, "-1" 表示不确定 Num int32 // 检测的人脸个数 }
GenderInfo 性别信息结构体
type ImageData ¶
type ImageData struct { PixelArrayFormat C.MUInt32 Width int Height int ImageData [4][]uint8 WidthStep [4]int }
ImageData 对应ASVLOFFSCREEN结构体
type ImageInfo ¶
ImageInfo 包含图片数据和宽高信息的结构体
func GetResizedImageInfo ¶
GetResizedImageInfo 获取适配SDK大小的图片,并转为BGR格式的数据
type LivenessInfo ¶
LivenessInfo 活体信息
type LivenessThreshold ¶
LivenessThreshold 活体置信度结构体
type MultiFaceInfo ¶
type MultiFaceInfo struct { FaceRect []Rect // 人脸框信息 FaceOrient []int32 // 输入图像的角度 FaceNum int32 // 检测到的人脸个数 FaceID []int32 // face ID,IMAGE模式下不返回FaceID // contains filtered or unexported fields }
MultiFaceInfo 多人脸信息结构体
type SingleFaceInfo ¶
type SingleFaceInfo struct { FaceRect Rect // 人脸框信息 FaceOrient int32 // 输入图像的角度,可以参考 ArcFaceCompare_OrientCode }
SingleFaceInfo 单人脸信息结构体
func GetSingleFaceInfo ¶
func GetSingleFaceInfo(multiFaceInfo MultiFaceInfo) (faceInfo []SingleFaceInfo)
GetSingleFaceInfo 从多人脸结构体中提取单人脸信息