private bool LoadTrainingData() { mydb = new DBConn(); allname = mydb.getAllImageID(); string[] allname_st = allname.Select(x => x.ToString()).ToArray(); trainingImages = mydb.getTrainedImageList(); //trainingImages = mydb.getRawTrainedImageList(); if (mydb.getImageCount() > 0) { if (trainingImages.Length != 0) { //set round and ... //termCrit = new MCvTermCriteria(mydb.getImageCount(), 0.001); termCrit = new MCvTermCriteria(5000, 0.0001); //Eigen face recognizer recognizer = new EigenObjectRecognizer(trainingImages, allname_st, maxRecognizeTreshold, ref termCrit); return(true); } else { return(false); } } else { return(false); } }
private bool LoadTrainingData() { mydb = new DBConn(); imagelabel = mydb.getLabelNumList().ToArray(); imageStringlabel = mydb.getLabelList().ToArray(); trainingImages = mydb.getTrainedImageList(); Itrainingimage = trainingImages; if (mydb.getImageCount() > 0) { if (trainingImages.Length != 0) { f_recognize = new FisherFaceRecognizer(0, 123.0); f_recognize.Train(Itrainingimage, imagelabel); return(true); } else { return(false); } } else { return(false); } }
private bool LoadTrainingData() { mydb = new DBConn(); allname = mydb.getLabelList(); trainingImages = mydb.getTrainedImageList(); int[] temp = Enumerable.Range(0, (allname.Count)).ToArray(); if (mydb.getImageCount() > 0) { if (trainingImages.Length != 0) { //set round and ... //termCrit = new MCvTermCriteria(mydb.getImageCount(), 0.001); //Eigen face recognizer recognizer = new FisherFaceRecognizer(0, 3200);//4000 recognizer.Train(trainingImages, temp); return(true); } else { return(false); } } else { return(false); } }
private bool LoadTrainingData() { mydb = new DBConn(); imagelabel = mydb.getLabelNumList().ToArray(); imageStringlabel = mydb.getLabelList().ToArray(); trainingImages = mydb.getTrainedImageList(); Itrainingimage = trainingImages; if (mydb.getImageCount() > 0) { if (trainingImages.Length != 0) { f_recognize = new FisherFaceRecognizer(0, 123.0); f_recognize.Train(Itrainingimage, imagelabel); return true; } else { return false; } } else { return false; } }
public TestRecog() { mydb = new DBConn(); totalImage = mydb.getImageCount(); trainImageArr = mydb.getTrainedImageList(); diffFaceList = new List<Image<Gray, byte>>(); AvgFace = getAVGface(trainImageArr); diffFaceArr = getDiffFace(); }
public TestRecog() { mydb = new DBConn(); totalImage = mydb.getImageCount(); trainImageArr = mydb.getTrainedImageList(); diffFaceList = new List <Image <Gray, byte> >(); AvgFace = getAVGface(trainImageArr); diffFaceArr = getDiffFace(); }
private bool LoadTrainingData() { mydb = new DBConn(); allname = mydb.getLabelList(); trainingImages = mydb.getTrainedImageList(); int[] temp = Enumerable.Range(0,(allname.Count)).ToArray(); if (mydb.getImageCount() > 0) { if (trainingImages.Length != 0) { //set round and ... //termCrit = new MCvTermCriteria(mydb.getImageCount(), 0.001); //Eigen face recognizer recognizer = new FisherFaceRecognizer(0,3200);//4000 recognizer.Train(trainingImages, temp); return true; } else { return false; } } else { return false; } }
public Form1() { InitializeComponent(); face = new HaarCascade("haarcascade_frontalface_default.xml"); eyeWithGlass = new CascadeClassifier("haarcascade_eye_tree_eyeglasses.xml"); mydb = new DBConn(); maxImageCount = (int)Math.Sqrt(mydb.getImageCount()); if (maxImageCount % 2 == 0) { maxImageCount--; if(maxImageCount > 15){ maxImageCount = 15; } } else { if (maxImageCount > 15) { maxImageCount = 15; } } progressBar1.Maximum = maxImageCount; recogNameResult = new List<string>(); recogDistanceResult = new List<double>(); minEye = new Size(10, 10); maxEye = new Size(225, 225); font = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.4d, 0.4d); fontbig = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.6d, 0.6d); fontverybig = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.8d, 0.8d); //log record DateTime now = DateTime.Now; logName = now.ToString(); logName = logName.Replace("/", "").Replace(":", "").Replace(" ", ""); label2.Text = "Idle"; if(File.Exists("setting.txt")){ folderPath = File.ReadAllText("setting.txt"); } else { FolderBrowserDialog b = new FolderBrowserDialog(); b.Description = "Please select your installation path"; DialogResult r = b.ShowDialog(); if (r == DialogResult.OK) // Test result. { folderPath = b.SelectedPath; Console.WriteLine(folderPath); File.WriteAllText(@"setting.txt", folderPath); MessageBox.Show("Path is at " + folderPath); } } pL[0] = new Point(x0, y0); pL[1] = new Point(x0, y1); pL[2] = new Point(x1, y1); pR[0] = new Point(x3, y0); pR[1] = new Point(x3, y1); pR[2] = new Point(x2, y1); eigenRecog = new Classifier_Train(); }
private bool LoadTrainingData() { mydb = new DBConn(); allname = mydb.getAllImageID(); string[] allname_st = allname.Select(x => x.ToString()).ToArray(); trainingImages = mydb.getTrainedImageList(); //trainingImages = mydb.getRawTrainedImageList(); if (mydb.getImageCount() > 0) { if (trainingImages.Length != 0) { //set round and ... //termCrit = new MCvTermCriteria(mydb.getImageCount(), 0.001); termCrit = new MCvTermCriteria(5000, 0.0001); //Eigen face recognizer recognizer = new EigenObjectRecognizer(trainingImages, allname_st, maxRecognizeTreshold, ref termCrit); return true; } else { return false; } } else { return false; } }
public Form1() { InitializeComponent(); face = new HaarCascade("haarcascade_frontalface_default.xml"); eyeWithGlass = new CascadeClassifier("haarcascade_eye_tree_eyeglasses.xml"); mydb = new DBConn(); maxImageCount = (int)Math.Sqrt(mydb.getImageCount()); if (maxImageCount % 2 == 0) { maxImageCount--; if (maxImageCount > 15) { maxImageCount = 15; } } else { if (maxImageCount > 15) { maxImageCount = 15; } } progressBar1.Maximum = maxImageCount; recogNameResult = new List <string>(); recogDistanceResult = new List <double>(); minEye = new Size(10, 10); maxEye = new Size(225, 225); font = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.4d, 0.4d); fontbig = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.6d, 0.6d); fontverybig = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.8d, 0.8d); //log record DateTime now = DateTime.Now; logName = now.ToString(); logName = logName.Replace("/", "").Replace(":", "").Replace(" ", ""); label2.Text = "Idle"; if (File.Exists("setting.txt")) { folderPath = File.ReadAllText("setting.txt"); } else { FolderBrowserDialog b = new FolderBrowserDialog(); b.Description = "Please select your installation path"; DialogResult r = b.ShowDialog(); if (r == DialogResult.OK) // Test result. { folderPath = b.SelectedPath; Console.WriteLine(folderPath); File.WriteAllText(@"setting.txt", folderPath); MessageBox.Show("Path is at " + folderPath); } } pL[0] = new Point(x0, y0); pL[1] = new Point(x0, y1); pL[2] = new Point(x1, y1); pR[0] = new Point(x3, y0); pR[1] = new Point(x3, y1); pR[2] = new Point(x2, y1); eigenRecog = new Classifier_Train(); }