资源简介

openCv 人脸识别源代码,编程环境是:VS2015大家需要先配置好环境,该源码加了人脸识别考勤点名上传到sql数据库的代码,大家只需要将time1的enabled事件设成True,再修改下指向连接的数据库及可。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.Util;
using Emgu.CV.CvEnum; 
using Emgu.CV.Features2D;
using System.IO;
using System.Data.SqlClient;
using System.Net;
using SpeechLib;
namespace FaceCap
{
    public partial class FaceCap : Form
    {
        Timer timer1 = new Timer();
        int counter = 0;
        private Capture cap;      
        private HaarCascade haar;
        Image Imageframe;
        MCvFont font = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX 0.5d 0.5d);
        Image result TrainedFace = null;
        Image gray = null;
        List> trainingImages = new List>();
        List labels = new List();
        List NamePersons = new List();
        int ContTrain NumLabels t;
        string name = null;
        string names = null;
       
        private void Processframe(object sender EventArgs arg)
        {

            NamePersons.Add(““);
            Imageframe = cap.Queryframe().Resize(640 480 Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
            gray = Imageframe.Convert();
            //Face Detector
            MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(haar 1.2 10 Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING new Size(20 20));
            //Action for each element detected
            foreach (MCvAvgComp f in facesDetected[0])
            {
                t = t + 1;
                result = Imageframe.Copy(f.rect).Convert().Resize(100 100 Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                //draw the face detected in the 0th (gray) channel with red color
                Imageframe.Draw(f.rect new Bgr(Color.Blue) 2);
                try
                {
                    if (trainingImages.ToArray().Length != 0)
                    {
                        //TermCriteria for face recognition with numbr of trained images like maxIteration
                        MCvTermCriteria termCrit = new MCvTermCriteria(ContTrain 0.001);
                        //Eigen face recognizer
                        EigenobjectRecognizer recognizer = new EigenobjectRecognizer(
                           trainingImages.ToArray()
                           labels.ToArray()
                           3500
                           ref termCrit);
                        name = recognizer.Recognize(result);
                        //显示识别后的人脸姓名或编号
                        textBox2.Text = name;
                        //Draw the label for each face detected and recognized
                        Imageframe.Draw(name ref font new Point(f.rect.X - 2 f.rect.Y - 2) new Bgr(Color.Red));
                    }
                }
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-14 14:30  Openvc 动态人脸识别对比学习(004)\
     文件         378  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\.gitattributes
     文件         574  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\.gitignore
     目录           0  2018-05-14 14:28  Openvc 动态人脸识别对比学习(004)\.vs\
     目录           0  2018-05-14 14:28  Openvc 动态人脸识别对比学习(004)\.vs\纵横智控智慧监狱人脸识别系统\
     目录           0  2018-05-14 14:28  Openvc 动态人脸识别对比学习(004)\.vs\纵横智控智慧监狱人脸识别系统\v14\
     文件       53248  2018-05-14 14:40  Openvc 动态人脸识别对比学习(004)\.vs\纵横智控智慧监狱人脸识别系统\v14\.suo
     文件         144  2018-05-08 14:41  Openvc 动态人脸识别对比学习(004)\app.config
     目录           0  2018-05-08 13:48  Openvc 动态人脸识别对比学习(004)\bin\
     目录           0  2018-05-14 14:40  Openvc 动态人脸识别对比学习(004)\bin\Debug\
     文件      325472  2018-05-14 14:39  Openvc 动态人脸识别对比学习(004)\bin\Debug\2018-05-14_143944.png
     文件      325782  2018-05-14 14:40  Openvc 动态人脸识别对比学习(004)\bin\Debug\2018-05-14_144011.png
     文件      603136  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\cvextern.dll
     文件      264704  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\Emgu.CV.dll
     文件      111616  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\Emgu.CV.UI.dll
     文件       10240  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\Emgu.CV.UI.resources.dll
     文件       23040  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\Emgu.Util.dll
     文件         490  2017-03-19 05:00  Openvc 动态人脸识别对比学习(004)\bin\Debug\FaceCap.vshost.exe.manifest
     文件      506314  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\haarcascade_eye.xml
     文件     3644763  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\haarcascade_frontalface_alt_tree.xml
     文件      176128  2018-05-08 15:18  Openvc 动态人脸识别对比学习(004)\bin\Debug\Interop.SpeechLib.dll
     文件      419840  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_calib3d220.dll
     文件      452608  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_contrib220.dll
     文件     2133504  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_core220.dll
     文件      815104  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_features2d220.dll
     文件     5536768  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_ffmpeg220.dll
     文件       30208  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_flann220.dll
     文件      151552  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_gpu220.dll
     文件      886784  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_highgui220.dll
     文件     1438720  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_imgproc220.dll
     文件      676864  2015-05-06 19:55  Openvc 动态人脸识别对比学习(004)\bin\Debug\opencv_legacy220.dll
............此处省略64个文件信息

评论

共有 条评论