C#下调试百度人脸离线SDK问题集

1、sdk_init 问题

in main
auth result is -1

运行控制台就停在  auth result is -1  

解决办法:

使用release 运行而不是使用debug

2、项目路径问题

因为我的项目放在了一个带有中文的路径下,在使用人脸注册的时候,出现了问题。

一直报错   Can't open database: unable to open database file

上网查,关于百度SDK问题,无果,

查关于C# sqllite的问题,无果,

有答案的分2种:

1、权限问题 

运行 calcs  加文件路径 + 权限 ,尝试后未解决

2、文件句柄问题

项目多次运行出现了未释放句柄(因为是百度底层实现的sql操作,应该不会出现这样弱智的错误)尝试后无果。

 

最后只能猜是文件路径问题,转移文件到根目录,运行,ok。

3、C#如何实现form窗体预览 

控件:

using AForge;
using AForge.Controls;
using AForge.Video;
using AForge.Video.DirectShow;
using Size = System.Drawing.Size;

页面上添加:videoSourcePlayer1

代码:

videoDevices = new FilterInfoCollection(AForge.Video.DirectShow.FilterCategory.VideoInputDevice);
            index_usb = 1;
                         videoSource = new VideoCaptureDevice(videoDevices[index_usb].MonikerString);//连接摄像头。
                        videoSource.VideoResolution = videoSource.VideoCapabilities[index_usb];
                         videoSourcePlayer1.VideoSource = videoSource;
                         // set NewFrame event handler
              videoSourcePlayer1.Start();
            timer1.Enabled = true;
            Face.test_face_setting();//人脸识别设置
            Face.test_face_manager();//照片库管理

         FaceCompare.load_db_face();//将照片库加载到内存

定时器:

//定时获取照片 通过照片和加载到内存的照片库进行比对

 private void timer1_Tick_1(object sender, EventArgs e)
        {
            RotatedRect box;
            Bitmap bitmap = videoSourcePlayer1.GetCurrentVideoFrame();
            string fileName = i+".jpg";
            i++;
            string filePase = @"D:\file\" + fileName;
            bitmap.Save(filePase, ImageFormat.Jpeg);
            FaceCompare  comp = new FaceCompare();
            comp.test_identify_with_all(filePase); //比对照片

            bitmap.Dispose();
           
        }

4、获取照片分辨率问题

_cameraDevice.VideoResolution = _cameraDevice.VideoCapabilities[15];//分辨率,每个摄像头获取到的分辨率数组不同,这里按需要选择分辨率。

加上这个,否则照片分辨率太低,也是无法进行读取特征值的。会导致识别失败

 

 

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值