private void button6_Click(object sender, EventArgs e) { string fileName = textBox1.Text; string[] res; string userid; string txtAR; string[] arSp; Image <Gray, byte> temp; for (int i = 40; i < 71; i++) { temp = new Image <Gray, byte>(@"E:\ImageTestSet2\" + fileName + i + ".jpg"); res = imageCheckRecognize(temp); userid = db.getUserIdFromSerrogate(res[0]); txtAR = db.getUserData(userid); arSp = txtAR.Split(' '); if (arSp.Length == 1) { File.AppendAllText(@"E:\ImageTestSet2\testRes.csv", arSp[0] + "," + res[1] + "\r\n"); } else { File.AppendAllText(@"E:\ImageTestSet2\testRes.csv", arSp[1] + "," + res[1] + "\r\n"); } } }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { string selectData = mydb.getUserData(comboBox3.Text); string[] splitData = selectData.Split(' '); textBox1.Text = splitData[1]; textBox2.Text = splitData[2]; dateTimePicker1.Text = splitData[3]; comboBox1.Text = splitData[5]; comboBox2.Text = splitData[6]; }
private void runAR(string nameID) { Rectangle drawArea = new Rectangle(framePoint, frameSize); Rectangle drawArea2 = new Rectangle(new Point(framePoint.X + 15, framePoint.Y + 15), new Size(140, 175)); Image <Bgr, Byte> opacityOverlay = new Image <Bgr, Byte>(drawArea.Width, drawArea.Height, new Bgr(Color.Black)); drawFrame.ROI = drawArea; opacityOverlay.CopyTo(drawFrame); drawFrame.ROI = Rectangle.Empty; double alpha = 0.7; double beta = 1 - alpha; double gamma = 0; drawFrame.Draw(drawArea, new Bgr(Color.Black), 2); drawFrame = imageFrame.AddWeighted(drawFrame, alpha, beta, gamma); drawFrame.Draw(drawArea, new Bgr(Color.LimeGreen), 2); ////***********TEXT*********** if (!ARDisplayFlag) { if (!nameID.Equals("0")) { txtAR = mydb.getUserData(nameID); } else { txtAR = "Can not recognize any face"; } Console.WriteLine("loop"); } Console.WriteLine(txtAR + " " + nameID); //txtAR = "abc def ghi"; int tmpY = framePoint.Y; if (!nameID.Equals("0")) { string[] txtSet = txtAR.Split(' '); for (int i = 0; i < txtSet.Length + 1; i++) { switch (i) { case 0: drawFrame.Draw(" User ID: " + txtSet[i], ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); label9.Text = "User ID: " + txtSet[i]; tmpY += 30; break; case 1: drawFrame.Draw(" Name: " + txtSet[i], ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); label4.Text = "Name: " + txtSet[i]; tmpY += 30; break; case 2: drawFrame.Draw(" Surname: " + txtSet[i], ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); label5.Text = "Surname: " + txtSet[i]; tmpY += 30; break; case 3: drawFrame.Draw(" Birthdate: " + txtSet[i], ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); label7.Text = "Birthdate: " + txtSet[i]; tmpY += 30; break; case 4: break; case 5: drawFrame.Draw("Blood group: " + txtSet[i], ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); label6.Text = "Blood group: " + txtSet[i]; tmpY += 30; break; case 6: drawFrame.Draw(" Gender: " + txtSet[i], ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); label8.Text = "Gender: " + txtSet[i]; tmpY += 30; break; case 7: drawFrame.Draw(" Confident: " + Math.Round(confident, 2), ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); tmpY += 30; break; default: break; } } } else { string txtSet = txtAR; label4.Text = ""; label5.Text = ""; label6.Text = ""; label7.Text = ""; label8.Text = ""; label9.Text = ""; drawFrame.Draw(txtSet, ref font, new Point(framePoint.X + 170, tmpY + 30), new Bgr(Color.LawnGreen)); } ////***********Picture*********** if (!ARDisplayFlag) { imgAR = mydb.getResultImage(name); } Image <Bgr, Byte> imageSrc = imgAR.Convert <Bgr, byte>(); drawFrame.ROI = drawArea2; CvInvoke.cvCopy(imageSrc, drawFrame, IntPtr.Zero); drawFrame.ROI = Rectangle.Empty; ARDisplayFlag = true; }