Documentation ¶
Index ¶
- Constants
- func GetActiveDeviceInfo() ([]byte, error)
- func OfflineActivation(filePath string) (err error)
- func OnlineActivation(appID, sdkKey, activeKey string) (err error)
- type ActiveFileInfo
- type AgeInfo
- type EngineError
- type Face3DAngle
- type Face3DAngleInfo
- type FaceEngine
- func (engine *FaceEngine) Destroy() (err error)
- func (engine *FaceEngine) DetectFaces(width int, 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) (confidenceLevel float32, err error)
- func (engine *FaceEngine) FaceFeatureExtract(width int, height int, format C.MInt32, imgData []byte, ...) (faceFeature FaceFeature, err error)
- func (engine *FaceEngine) FaceFeatureExtractEx(imageData ImageData, faceInfo SingleFaceInfo, registerOrNot int, mask int) (feature FaceFeature, err error)
- func (engine *FaceEngine) GetAge() (AgeInfo, error)
- func (engine *FaceEngine) GetGender() (GenderInfo, error)
- func (engine *FaceEngine) GetLivenessScore() (LivenessInfo, error)
- func (engine *FaceEngine) GetLivenessScoreIR() (LivenessInfo, error)
- func (engine *FaceEngine) GetMask() (maskInfo MaskInfo, err error)
- func (engine *FaceEngine) GetVersion() Version
- func (engine *FaceEngine) ImageQualityDetect(width int, height int, format C.MInt32, imgData []byte, ...) (confidenceLevel float32, err error)
- func (engine *FaceEngine) Process(width int, height int, format C.MInt32, imgData []byte, ...) error
- func (engine *FaceEngine) ProcessEx(imageData ImageData, faceInfo MultiFaceInfo, combinedMask C.MInt32) error
- func (engine *FaceEngine) ProcessExIR(imageData ImageData, faceInfo MultiFaceInfo, combinedMask C.MInt32) (err error)
- func (engine *FaceEngine) ProcessIR(width int, height int, format C.MInt32, imgData []byte, ...) (err error)
- func (engine *FaceEngine) SetLivenessParam(threshold LivenessThreshold) error
- func (engine *FaceEngine) UpdateFaceData(width int, height int, format C.MInt32, imgData []byte, faceInfo MultiFaceInfo) (err error)
- type FaceFeature
- type FaceLandMark
- type GenderInfo
- type ImageData
- type LandMarkInfo
- type LivenessInfo
- type LivenessThreshold
- type MaskInfo
- type MultiFaceInfo
- type Rect
- type SingleFaceInfo
- type Version
Constants ¶
const ( // DetectModeVideo 视频模式 DetectModeVideo = C.ASF_DETECT_MODE_VIDEO // DetectModeImage 图片模式 DetectModeImage = C.ASF_DETECT_MODE_IMAGE // OrientPriority0 不旋转 OrientPriority0 = C.ASF_OP_0_ONLY // OrientPriority90 旋转90度 OrientPriority90 = C.ASF_OP_90_ONLY // OrientPriority270 旋转270度 OrientPriority270 = C.ASF_OP_270_ONLY // OrientPriority180 旋转180度 OrientPriority180 = C.ASF_OP_180_ONLY // OrientPriorityAllOut 角度不限 OrientPriorityAllOut = C.ASF_OP_ALL_OUT // EnableNone 不开启任何功能 EnableNone = C.ASF_NONE // EnableFaceDetect 开启人脸检测 EnableFaceDetect = C.ASF_FACE_DETECT // EnableFaceRecognition 开启人脸识别 EnableFaceRecognition = C.ASF_FACERECOGNITION // EnableAge 开启年龄检测 EnableAge = C.ASF_AGE // EnableGender 开启性别检测 EnableGender = C.ASF_GENDER // EnableLiveness 开启活体检测 EnableLiveness = C.ASF_LIVENESS // EnableIRLiveness 开启IR活体检测 EnableIRLiveness = C.ASF_IR_LIVENESS // EnableImageQuality 开启单人脸图片质量检测 EnableImageQuality = C.ASF_IMAGEQUALITY // EnableMaskDetect 开启口罩检测 EnableMaskDetect = C.ASF_MASKDETECT // EnableUpdateFaceData 开启人脸数据更新 EnableUpdateFaceData = C.ASF_UPDATE_FACEDATA // ColorFormatBGR24 BGR24格式 ColorFormatBGR24 = C.ASVL_PAF_RGB24_B8G8R8 // ColorFormatNV12 NV12格式 ColorFormatNV12 = C.ASVL_PAF_NV12 // ColorFormatNV21 NV21格式 ColorFormatNV21 = C.ASVL_PAF_NV21 // ColorFormatI420 I420格式 ColorFormatI420 = C.ASVL_PAF_I420 // ColorFormatYUYV YUYV格式 ColorFormatYUYV = C.ASVL_PAF_YUYV // RecognitionPhoto 识别照片 RecognitionPhoto = C.ASF_RECOGNITION // RegisterPhoto 注册照片 RegisterPhoto = C.ASF_REGISTER )
Variables ¶
This section is empty.
Functions ¶
func GetActiveDeviceInfo ¶
GetActiveDeviceInfo 采集当前设备信息(可离线)
func OfflineActivation ¶
OfflineActivation 离线激活接口
func OnlineActivation ¶
OnlineActivation 在线激活接口
Types ¶
type ActiveFileInfo ¶
type ActiveFileInfo struct { StartTime string //开始时间 EndTime string //截止时间 ActiveKey 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 Face3DAngleInfo ¶
type FaceEngine ¶
type FaceEngine struct {
// contains filtered or unexported fields
}
FaceEngine 引擎结构体
func NewFaceEngine ¶
func NewFaceEngine( detectMode C.ASF_DetectMode, orientPriority C.ASF_OrientPriority, maxFaceNum C.MInt32, combinedMask C.MInt32, ) (*FaceEngine, error)
NewFaceEngine 创建一个新的引擎实例
如果调用初始化函数失败则返回一个错误
func (*FaceEngine) DetectFaces ¶
func (engine *FaceEngine) DetectFaces( width int, 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) (confidenceLevel float32, err error)
FaceFeatureCompare 人脸特征比对
func (*FaceEngine) FaceFeatureExtract ¶
func (engine *FaceEngine) FaceFeatureExtract( width int, height int, format C.MInt32, imgData []byte, faceInfo SingleFaceInfo, registerOrNot int, mask int, ) (faceFeature FaceFeature, err error)
FaceFeatureExtract 单人脸特征提取
func (*FaceEngine) FaceFeatureExtractEx ¶
func (engine *FaceEngine) FaceFeatureExtractEx( imageData ImageData, faceInfo SingleFaceInfo, registerOrNot int, mask int, ) (feature FaceFeature, err error)
FaceFeatureExtractEx 单人脸特征提取
该接口与 ASFFaceFeatureExtract 功能一致,但采用结构体的形式传入图像数据,对更高精度的图像兼容性更好
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) GetMask ¶
func (engine *FaceEngine) GetMask() (maskInfo MaskInfo, err error)
GetMask 获取口罩信息
func (*FaceEngine) ImageQualityDetect ¶
func (engine *FaceEngine) ImageQualityDetect( width int, height int, format C.MInt32, imgData []byte, faceInfo SingleFaceInfo, isMask int, ) (confidenceLevel float32, err error)
ImageQualityDetect 单人脸图片质量检测
func (*FaceEngine) Process ¶
func (engine *FaceEngine) Process( width int, 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) ProcessExIR ¶
func (engine *FaceEngine) ProcessExIR( imageData ImageData, faceInfo MultiFaceInfo, combinedMask C.MInt32, ) (err error)
ProcessExIR 该接口目前仅支持单人脸IR活体检测(不支持年龄、性别、3D角度的检测),默认取第一张人脸
该接口与 ProcessIR 功能一致,但采用结构体的形式传入图像数据,对更高精度的图像兼容性更好
func (*FaceEngine) ProcessIR ¶
func (engine *FaceEngine) ProcessIR( width int, height int, format C.MInt32, imgData []byte, detectedFaces MultiFaceInfo, combinedMask C.MInt32, ) (err error)
ProcessIR 该接口目前仅支持单人脸IR活体检测(不支持年龄、性别、3D角度的检测),默认取第一张人脸
func (*FaceEngine) SetLivenessParam ¶
func (engine *FaceEngine) SetLivenessParam(threshold LivenessThreshold) error
SetLivenessParam 设置活体置信度
取值范围[0-1]内部默认数值RGB-0.75,IR-0.7, 用户可以根据实际需求,设置不同的阈值
func (*FaceEngine) UpdateFaceData ¶
func (engine *FaceEngine) UpdateFaceData( width int, height int, format C.MInt32, imgData []byte, faceInfo MultiFaceInfo, ) (err error)
UpdateFaceData 更新人脸数据
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 LivenessInfo ¶
LivenessInfo 活体信息
type LivenessThreshold ¶
LivenessThreshold 活体置信度结构体
type MultiFaceInfo ¶
type MultiFaceInfo struct { FaceNum int32 // 检测到的人脸个数 FaceRect []Rect // 人脸框信息 FaceOrient []int32 // 输入图像的角度 FaceID []int32 // face ID,IMAGE模式下不返回FaceID WearGlasses float32 // 带眼镜置信度[0-1],推荐阈值0.5 Face3DAngle Face3DAngleInfo ForeheadRect []Rect FaceDataInfoList []C.ASF_FaceDataInfo // 多张人脸信息 // contains filtered or unexported fields }
MultiFaceInfo 多人脸信息结构体
type SingleFaceInfo ¶
type SingleFaceInfo struct { FaceRect Rect // 人脸框信息 FaceOrient int32 // 输入图像的角度,可以参考 ArcFaceCompare_OrientCode DataInfo C.ASF_FaceDataInfo }
SingleFaceInfo 单人脸信息结构体
func GetSingleFaceInfo ¶
func GetSingleFaceInfo(multiFaceInfo MultiFaceInfo) (faceInfo []SingleFaceInfo)
GetSingleFaceInfo 从多人脸结构体中提取单人脸信息