예제 #1
0
 private void FaceDetection()
 {
     TSFaceDetection.TSFaceDetection tSFaceDetection = new TSFaceDetection.TSFaceDetection();
     //TSFaceDetection.TSFaceDetection.OpenCVResult openCVResult = new TSFaceDetection.TSFaceDetection.OpenCVResult();
     if (radioButton_Cascade.Checked)
     {
         tSFaceDetection.FaceDetect(Text_FilePath.Text, "D:\\test.txt", "haarcascade_frontalface_default.xml", 10);
     }
     else if (radioButton_YOLO.Checked)
     {
         tSFaceDetection.FaceDetect(Text_FilePath.Text, "D:\\test.txt", YOLO_cfg, YOLO_weights, Labels, DetectClass, 10);
     }
 }
예제 #2
0
        private void btm_Start_Click(object sender, EventArgs e)
        {
            SF.Filter = "All files (*.*)|*.*";
            if (SF.ShowDialog() == DialogResult.OK)
            {
                int Index = SF.FileName.IndexOf(".");
                SaveFileName = (Index == -1 ? String.Concat(SF.FileName, ext) : String.Concat(SF.FileName.Substring(0, SF.FileName.IndexOf(".")), ext));
                SF.Dispose();
                if (ext == ".jpg")
                {
                    btm_Play.Enabled  = false;
                    btm_Pause.Enabled = false;
                    TSFaceDetection.TSFaceDetection tSFaceDetection = new TSFaceDetection.TSFaceDetection();
                    tSFaceDetection.FaceReduction(Text_FilePath.Text, "D:\\test.txt", SaveFileName);
                    showFrame();
                }
                else
                {
                    btm_Play.Enabled  = false;
                    btm_Pause.Enabled = false;
                    objVideoCapture   = null;
                    objVideoCapture   = new Emgu.CV.VideoCapture(Text_FilePath.Text);
                    TSFaceDetection.TSFaceDetection tSFaceDetection = new TSFaceDetection.TSFaceDetection();
                    tSFaceDetection.FaceReduction(Text_FilePath.Text, "D:\\test.txt", SaveFileName);

                    objVideoCapture_Before = new Emgu.CV.VideoCapture(Text_FilePath.Text);
                    objVideoCapture_After  = new Emgu.CV.VideoCapture(SaveFileName);
                    FrameCount             = 0;
                    objVideoCapture_Before.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.PosFrames, FrameCount);
                    objVideoCapture_After.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.PosFrames, FrameCount);
                    showFrame();

                    btm_Play.Enabled  = true;
                    btm_Pause.Enabled = true;
                }
            }
        }