public BatchClassificationDialog(ref Klu klu, ref TrainingDataSet dataSet, ProcessOptions processOptions)
        {
            InitializeComponent();

            _BackgroundWorker = new BackgroundWorker();
            _BackgroundWorker.WorkerReportsProgress      = true;
            _BackgroundWorker.WorkerSupportsCancellation = true;
            _BackgroundWorker.DoWork             += new DoWorkEventHandler(DoWork);
            _BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunWorkerCompleted);
            _BackgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(ProgressChanged);

            BrowseButton.IsEnabled   = true;
            CancelButton.IsEnabled   = false;
            ClassifyButton.IsEnabled = false;

            _DataSet        = dataSet;
            _SelectedFiles  = new ArrayList();
            _ProcessOptions = processOptions;
            // We want the images to be as less distorded as possible, so we disable all the overlays.

            _ProcessOptions.DrawAnthropometricPoints = 0;
            _ProcessOptions.DrawDetectionTime        = 0;
            _ProcessOptions.DrawFaceRectangle        = 0;
            _ProcessOptions.DrawSearchRectangles     = 0;
            _ProcessOptions.DrawFeaturePoints        = 0;

            _KLU        = klu;
            _FFP        = new FaceFeaturePoints();
            _TempBitmap = new System.Drawing.Bitmap(10, 10);

            ExpressionsComboBox.ItemsSource = _DataSet.Expression;
            ClassifyButton.Content          = "Classify";
        }
Esempio n. 2
0
        /// <summary>
        /// Constructs a new AnnDialog.
        /// </summary>
        public AnnDialog(ref Klu Klu)
        {
            InitializeComponent();

            _Klu = Klu;

            #region Initialize ANN stuff
            _ANN           = new ANN();
            _ANN.NumLayers = 3;
            _ANN.SetNumNeurons(0, 38);
            _ANN.SetNumNeurons(1, 6);
            _ANN.SetNumNeurons(2, 7);

            // Bind certain labels to ANN stuff
            AnnNumLayers.DataContext = _ANN;

            // Bind DataGrid to ANN-DataSet now
            _DataSet = new DataSet("HiddenLayer");
            _DataSet.Tables.Add("HiddenLayerTable");
            uint tmp = 0;
            _DataSet.Tables[0].Columns.Add("Neurons", tmp.GetType());
            tmp = 6;
            _DataSet.Tables[0].Rows.Add(tmp);
            HiddenLayerDataGrid.DataContext = _DataSet.Tables[0];
            #endregion
        }
Esempio n. 3
0
        public BatchClassification(ref Klu klu, ref TrainingDataSet dataSet, ProcessOptions processOptions)
        {
            InitializeComponent();

            _DataSet        = dataSet;
            _SelectedFiles  = new ArrayList();
            _ProcessOptions = processOptions;
            // We want the images to be as less distorded as possible, so we disable all the overlays.

            _ProcessOptions.DrawAnthropometricPoints = 0;
            _ProcessOptions.DrawDetectionTime        = 0;
            _ProcessOptions.DrawFaceRectangle        = 0;
            _ProcessOptions.DrawSearchRectangles     = 0;
            _ProcessOptions.DrawFeaturePoints        = 0;

            _KLU        = klu;
            _FFP        = new FaceFeaturePoints();
            _TempBitmap = new System.Drawing.Bitmap(10, 10);

            ExpressionsComboBox.ItemsSource = _DataSet.Expression;
            ClassifyButton.Content          = "Classify";
        }
        /// <summary>
        /// The main entry point for this window.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            Console.WriteLine("Loc: " + System.Reflection.Assembly.GetExecutingAssembly().Location);

            try
            {
                _CurrentImagePathIndex = 0;
                _ImagePathArray        = new ArrayList();
                _ProcessOptions        = new ProcessOptions();
                _FFP = new FaceFeaturePoints();

                _ProcessOptions.DoEyeProcessing          = 1;
                _ProcessOptions.DoMouthProcessing        = 1;
                _ProcessOptions.DrawAnthropometricPoints = 0;
                _ProcessOptions.DrawSearchRectangles     = 0;
                _ProcessOptions.DrawFaceRectangle        = 1;
                _ProcessOptions.DrawDetectionTime        = 1;
                _ProcessOptions.DrawFeaturePoints        = 1;
                _ProcessOptions.DoVisualDebug            = 0;

                #region Intialize encapsulated OpenCV subsystem
                _KLU        = new Klu();
                _TempBitmap = new System.Drawing.Bitmap(10, 10);

                // Create a Timer with a Normal Priority
                _CaptureTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle, this.Dispatcher);

                // Set the callback to just show the time ticking away
                // NOTE: We are using a control so this has to run on
                // the UI thread
                _CaptureTimer.Tick += new EventHandler(
                    delegate(object s, EventArgs a)
                {
                    _KLU.ProcessCaptureImage(ref _ProcessOptions, ref _FFP);

                    // Ensure the image (bitmap) we are writing to has the correct dimensions
                    int width = 0, height = 0;
                    _KLU.GetLastProcessedImageDims(ref width, ref height);

                    if (_TempBitmap.Width != width || _TempBitmap.Height != height)
                    {
                        Console.WriteLine("Need to resize the _TempBitmap to " + width + "x" + height);
                        _TempBitmap.Dispose();
                        GC.Collect();
                        _TempBitmap = new System.Drawing.Bitmap(width, height);
                    }

                    _KLU.GetLastProcessedImage(ref _TempBitmap);
                    _KLU.SetWpfImageFromBitmap(ref image1, ref _TempBitmap);
                    //_KLU.SetImageBrushFromBitmap(ref imageBrush, ref _TempBitmap);
                }
                    );
                #endregion

                #region "Connect" to database
                _TAM     = new TableAdapterManager();
                _DataSet = new TrainingDataSet();

                // Load data from SQL database and fill our DataSet
                _TAM.ExpressionTableAdapter = new ExpressionTableAdapter();
                _TAM.TrainingTableAdapter   = new TrainingTableAdapter();

                LoadData();
                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }