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);//缩放摄像头拍到的大尺寸照片gray = smallframe.Convert<Gray, Byte>(); //Convert it to Grayscalegray._EqualizeHist();//均衡化CascadeClassifier ccr = new CascadeClassifier(@"E:\BC