1,安装EMgu
在NuGet中,查找并安装EMgu
2,做人脸检测
首先,声明几个重要的类
//Thread.Sleep(3000);
matImg = new Mat();
capture.Retrieve(matImg, 0);
frame=new Image<Bgr, byte>(matImg.Bitmap);
当,frame != null时,检测到人脸
3,给人脸画框
if (frame != null)
{
//face detection
//frame = frame.Flip(Emgu.CV.CvEnum.FLIP.HORIZONTAL);
smallframe = frame.Resize(1 / scale, Emgu.CV.CvEnum.Inter.Cubic);//缩放摄像头拍到的大尺寸照片

本文介绍了如何在.NET环境中利用EMgu库进行人脸识别。首先通过NuGet安装EMgu,然后声明并使用关键类来检测人脸。当检测到帧不为空时,程序会为人脸绘制边界框。最后展示了应用的效果。
订阅专栏 解锁全文
558

被折叠的 条评论
为什么被折叠?



