C# 百度人脸识别

1、到百度官方网站购买Key,和下载C#人脸识别项目

2、本地绑定Key

// sdk初始化
        [DllImport("BaiduFaceApi.dll", EntryPoint = "sdk_init", CharSet = CharSet.Ansi
            , CallingConvention = CallingConvention.Cdecl)]
        public static extern int sdk_init(string model_path);
        // 特征值比对(传2个人脸的特征值,所有的1:1比对归根结底都是特征值比对,都可通过提取特征值来比对)
        [DllImport("BaiduFaceApi.dll", EntryPoint = "compare_feature", CharSet = CharSet.Ansi
            , CallingConvention = CallingConvention.Cdecl)]
        // type为0表示提取生活照的特征值,1表示证件照的特征值,2表示nir的特征值
        private static extern float compare_feature(ref BDFaceFeature f1, ref BDFaceFeature f2, int type = 0);

        //人脸检测 type 0: 表示rgb 人脸检测 1:表示nir人脸检测
        [DllImport("BaiduFaceApi.dll", EntryPoint = "detect", CharSet = CharSet.Ansi
           , CallingConvention = CallingConvention.Cdecl)]
        public static extern int detect(IntPtr ptr, IntPtr mat, int type);

        [DllImport("BaiduFaceApi.dll", EntryPoint = "face_blur", CharSet = CharSet.Ansi
       , CallingConvention = CallingConvention.Cdecl)]
        private static extern int face_blur(IntPtr ptr, IntPtr mat);
        // 单目RGB静默活体检测
        [DllImport("BaiduFaceApi.dll", EntryPoint = "rgb_liveness", CharSet = CharSet.Ansi
           , CallingConvention = CallingConvention.Cdecl)]
        private static extern int rgb_liveness(IntPtr ptr_trackinfo, IntPtr ptr_score, IntPtr mat);

        // 提取人脸特征值
        [DllImport("BaiduFaceApi.dll", EntryPoint = "face_feature", CharSet = CharSet.Ansi
            , CallingConvention = CallingConvention.Cdecl)]
        // 返回num为特征值的人数,type为0表示提取生活照的特征值,1表示证件照的特征值,2表示nir的特征值
        public static extern int face_feature(IntPtr feature, IntPtr box, IntPtr mat, int type);
        // 返回num为特征值的人数,通过rgb+depth双面摄像头提取特征值
        [DllImport("BaiduFaceApi.dll", EntryPoint = "rgbd_feature", CharSet = CharSet.Ansi
           , CallingConvention = CallingConvention.Cdecl)]
        public static extern int rgbd_feature(IntPtr feature, IntPtr box, IntPtr rgb_mat, IntPtr depth_mat);
        // 是否授权
        [DllImport("BaiduFaceApi.dll", EntryPoint = "is_auth", CharSet = CharSet.Ansi
               , CallingConvention = CallingConvention.Cdecl)]
        public static extern bool is_auth();
        // sdk销毁
        [DllImport("BaiduFaceApi.dll", EntryPoint = "sdk_destroy", CharSet = CharSet.Ansi
            , CallingConvention = CallingConvention.Cdecl)]

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天道酬勤~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值