Exemplo n.º 1
0
        private void addGesture()
        {
            string selectedItem = cbClasses.SelectedItem as String;
            string classLabel   = String.IsNullOrEmpty(selectedItem) ?
                                  cbClasses.Text : selectedItem;

            if (database.Add(canvas.GetSequence(), classLabel) != null)
            {
                canvas.Clear();

                if (database.Classes.Count >= 2 &&
                    database.SamplesPerClass() >= 3)
                {
                    btnLearnHMM.Enabled = true;
                }

                panelUserLabeling.Visible = false;
            }
        }
Exemplo n.º 2
0
        //add GEsture -- obsolete
        //private void addGesture()
        //{
        //    //get Text Lable for the performed gesture
        //    string selectedItem = cbClasses.SelectedItem as String;
        //    string classLabel = String.IsNullOrEmpty(selectedItem) ?
        //        cbClasses.Text : selectedItem;
        //    //add labelled gesture to database
        //    if (database.Add(canvas.GetSequence(), classLabel) != null)
        //    {
        //        canvas.Clear();

        //        if (database.Classes.Count >= 2 &&
        //            database.SamplesPerClass() >= 3)
        //            btnLearnHMM.Enabled = true;

        //        panelUserLabeling.Visible = false;
        //    }
        //}

        //add 3D gesture event (based on addGEsture) to database, adds the sequence(list of GestureData objects) and classLabel

        private void add3DGesture()
        {
            //get Text Label for the performed gesture
            string selectedItem = cbClasses.SelectedItem as String;
            string classLabel;

            if (detectionDone)
            {
                classLabel    = label; //from global label (detected)
                detectionDone = false;
            }
            else
            {
                classLabel = String.IsNullOrEmpty(selectedItem) ?
                             cbClasses.Text : selectedItem;
            }
            //add labelled gesture to database
            // canvas.setSequence();
            if (database.Add(Get3DSequence(), classLabel) != null) //!modify! canvas.get3Dsequnce
            {
                canvas.Clear();

                if (database.Classes.Count >= 2 &&
                    database.SamplesPerClass() >= 3)
                {
                    btnLearnHMM.Enabled = true;
                }

                panelUserLabeling.Visible = false;
            }

            System.Diagnostics.Debug.WriteLine("Sequence complete");

            //clear the sequence list, so it may be ready to receive data for next gesture
            sequence.Clear();     // = new List<GestureData>(); //!added. check
        }