資源簡介
用C#做學習型人臉識別程序(嘗鮮版)DEMO和源碼

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?Emgu.CV;
using?Emgu.CV.Structure;
using?System.IO;
namespace?FaceRecognition
{
????/***************
?????*?face?recognition
?????*?by?Nobi?(conmajia@gmail.com)
?????*?May?11th?2012
?????*?this?is?an?experiment
?????*?and?based?on?EmguCV
?????*?all?codes?are?almost?standard.
?????*?
?????*?Sergio?Andrés?Guitérrez?Rojas‘s?work
?????*?was?the?start?point.
?????*?More?features?added.?
?????*?--?conmajia
?????*??
?????*?use?it?in?anyway?as?you?wish.
?????*?you?can?keep?my?name?or?not.
?????*?it?depends?on?you.
?????*?all?that?I?expect?is?a?nice?meal.?(haha)
?????*?**************/
????public?partial?class?Form1?:?Form
????{
????????#region?variables
????????//?webcam
????????Capture?webcam;
????????bool?cameraInUse?=?false;
????????//?cascading?lib
????????HaarCascade?faceHaar;
????????//?Font?to?show?name
????????MCvFont?font?=?new?MCvFont(
????????????Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_TRIPLEX
????????????1.2
????????????1.2
????????????);
????????//?frame?being?dealing?dealed?trained
????????Image?current;
????????Image?gray?=?null;
????????//?List?to?store?trained?faces?&?people
????????List>?learnedFaces?=?new?List>();
????????List?learnedPeople?=?new?List();
????????MCvAvgComp[]?foundFaces;
????????#endregion
????????#region?initiates
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?initHaar(ref?HaarCascade?h?string?path)
????????{
????????????h?=?new?HaarCascade(path);
????????}
????????//?try?load?early?trained?faces
????????private?void?loadBackupImages(List>?list)
????????{
????????????//try
????????????//{
????????????//????//?names?stored?in?/backup/names.txt
????????????//????//?names?delimilited?by?‘|‘?(the?pipe)
????????????//????string?nameFileContent
????????????//????????=?File.ReadAllText(Application.StartupPath?+?“/backup/names.txt“);
????????????//????string[]?names?=?nameFileContent.Split(‘|‘);
????????????//????foreach?(string?name?in?names)
????????????//????{
????????????//????????//?load?images
????????????//????????list.Add(
????????????//????????????new?Image(
????????????//????????????????Application.StartupPath
????????????//????????????????+?“/backup/face_“
????????????//????????????????+?name
????????????//????????????????+?“.bmp“
????????????//????????????????)
????????????//????????????);
????????????//????????//?TODO:?change?list?into?dictionary
????????????//????????people.Add(name);
????????????//????}
????????????//}
????????????//catch?(Exception)
????????????//{
????????????//????Console.WriteLine(“Load?nothing?from?backup?files.“);
????????????//}
????????}
????????#endregio
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????10332??2012-05-11?22:05??Form1.Designer.cs
?????文件???????10652??2012-05-11?22:13??Form1.cs
?????文件??????506314??2012-05-11?18:15??haarcascade_eye.xm
?????文件?????3644763??2012-05-11?18:15??haarcascade_frontalface_alt_tree.xm
?????文件???????32768??2012-05-11?22:13??FaceRecognition.exe
- 上一篇:c# wpf全套教程視頻教程
- 下一篇:C#內存修改器
評論
共有 條評論