private void Sig_Click(object sender, RoutedEventArgs e)
        {
            if (images == null)
            {
                images = System.IO.Directory.GetFiles(@"E:\Bases de datos\FDDBppm\2002\07\25\big", "*.ppm");
                idx    = 0;
            }


            if (idx >= images.Length)
            {
                idx = 0;
            }

            Image <Bgr, Byte> im1 = new Image <Bgr, byte>(images[idx++]);;

            if (im1 != null)
            {
                ImageArchivo.Width  = im1.Width;
                ImageArchivo.Height = im1.Height;
                ImageArchivo.Source = CaptureWebCam.BitmapToImageSource(im1.ToBitmap());
                EV.ScanImageWithCascadeClassifier(im1, CascadeFaceDetectorDic);

                //       EV.ShowListWithoutCombine("12", CanvasArchivo);
                //     EV.ShowListWithoutCombine("24", CanvasArchivo);
                EV.ShowListWithoutCombine(CascadeFaceDetectorDic.Keys.Last(), CanvasArchivo);
//                EV.ShowList(CascadeFaceDetectorDic.Keys.Last(), CanvasArchivo);
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            #region instanciar variables globales
            string modelpath;

            CW = new CaptureWebCam(Image1);

            modelpath = @"E:\DeepLearning\Faces12Final\01_Convolution.293";

            //   modelpath = @"E:\DeepLearning\Faces12Final\02_BatchNormConv.417";
            FDC12 = new NetEvaluation(modelpath);

            //modelpath = @"E:\DeepLearning\cntk\Examples\FaceDetection16X16X3_VF\Output\Models\01_Convolution.77";
            modelpath = @"E:\DeepLearning\cntk\Examples\FaceDetection16X16X3_VF\Output\Models\01_Convolution.16";
            FDC16     = new NetEvaluation(modelpath);

            modelpath = @"E:\DeepLearning\cntk\Examples\FaceDetection24X24X3V2\Output\Models\01_Convolution.21";
            FDC24     = new NetEvaluation(modelpath);

            modelpath = @"E:\DeepLearning\cntk\Examples\FaceDetectionModels\Models\01_Convolution.100";
            FDC32     = new NetEvaluation(modelpath);



            modelpath = @"E:\DeepLearning\cntk\Examples\FaceDetection32X32X3\Output\Models\01_Convolution2.63";
            FDC32_2   = new NetEvaluation(modelpath);

            EV = new FaceDetector(Canvas1, 128, 4, 1.5f);
            EV.AddClassifier("322", FDC32_2, 32);
            EV.AddClassifier("32", FDC32, 24);
            EV.AddClassifier("24", FDC24, 24, Brushes.SkyBlue);
            EV.AddClassifier("16", FDC16, 16, Brushes.Violet);
            EV.AddClassifier("12", FDC12, 12, Brushes.YellowGreen);


            CascadeFaceDetectorDic = new Dictionary <string, float>();
            CascadeFaceDetectorDic.Add("12", 0.4f);
            CascadeFaceDetectorDic.Add("24", 0.6f);
            //s CascadeFaceDetectorDic.Add("322",0.645f);
//

            #endregion

            #region procesos temporales
            //  Utils.ReadFDDBFile(@"E:\Bases de datos\FDDB\FDDB-folds\FDDB-fold-01-ellipseList.txt");
            //  /    Utils.printOutputAndTargetList(FDC16.ReadUciFastReaderAndEvaluate(@"E:\Bases de datos\DatasetFacedetectionUCIreader\facedetector16X16X3Test.txt"));
            //fddb = new FDDB(EV);
            // fddbdatagenerate();

            #endregion
        }
        private void Siguiente_Click(object sender, RoutedEventArgs e)
        {
            if (images == null)
            {
                //   images = System.IO.Directory.GetFiles(@"E:\Bases de datos\AFWL\aflw\data\flickr", "*.jpg");
                images = System.IO.Directory.GetFiles(@"E:\Bases de datos\AFW\testimages", "*.jpg");
                images = System.IO.Directory.GetFiles(@"E:\Bases de datos\AFW", "*.jpg");

                //images = System.IO.Directory.GetFiles(@"E:\Bases de datos\ImageNet\Imagenes", "*.jpg");

                images = System.IO.Directory.GetFiles(@"C:\Users\Ideapad 300\Pictures", "*.jpg");
                idx    = 0;
            }

            if (idx >= images.Length)
            {
                idx = 0;
            }

            Image <Bgr, Byte> im1;

            try
            {
                im1 = new Image <Bgr, byte>(images[idx++]);
                if (im1 != null)
                {
                    im1 = im1.Resize(ImageFalsos.Height / ((double)im1.Height), Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                    ImageFalsos.Width  = im1.Width;
                    ImageFalsos.Source = CaptureWebCam.BitmapToImageSource(im1.ToBitmap());
                    EV.ScanImageWithCascadeClassifier(im1, CascadeFaceDetectorDic);
                    //EV.ShowListWithoutCombine("12", CanvasFalsos);
                    //EV.ShowListWithoutCombine("24", CanvasFalsos);
                    EV.ShowList(CascadeFaceDetectorDic.Keys.Last(), CanvasFalsos);
                }
            }
            catch {
            }
        }