private void resetButton_Click(object sender, EventArgs e) { Gestures.resetGestureInfo(); Gestures.saveData(); Gestures.loadData(Gestures.getPath()); LoadTable(); }
private void chooseModelButton_Click(object sender, EventArgs e) { var FD = new System.Windows.Forms.OpenFileDialog(); FD.Filter = "model files (*.svm)|*.svm|All files (*.*)|*.*"; if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string fileToOpen = System.IO.Path.GetFileName(FD.FileName); this.model.ModelFilePath = @fileToOpen; this.modelFileLabel.Text = fileToOpen; // Update gesture data based on model chosen. if (fileToOpen.Equals(GestureStudio.ModelFileNew)) { Gestures.loadData(GestureStudio.GesturesDataPathNew); } else if (fileToOpen.Equals(GestureStudio.ModelFileEmpty)) { Gestures.loadData(GestureStudio.GesturesDataPathEmpty); } else // Demo version { Gestures.loadData(GestureStudio.GesturesDataPathDemo); } } }
private void chooseDataFile_Click(object sender, EventArgs e) { DialogResult result = chooseFileDialog.ShowDialog(); if (result == DialogResult.OK) { string file = chooseFileDialog.FileName; try { Gestures.loadData(file); gestureDataGridView.Hide(); gestureDataGridView.Controls.Clear(); LoadTable(); gestureDataGridView.Show(); } catch (IOException) { } } }
private void mainWindowTabs_SelectedIndexChanged(object sender, EventArgs e) { if (mainWindowTabs.SelectedIndex == 1) { try { Gestures.loadData(Gestures.getPath()); gestureDataGridView.Hide(); gestureDataGridView.Controls.Clear(); LoadTable(); gestureDataGridView.Show(); } catch (IOException) { } } this.model.Stop(); this.controlButton.Text = "Start"; this.mainWindow_status.Text = "Your Gesture: []"; this.classifying = false; }
private void startButton_Click(object sender, EventArgs e) { SynchronizationContext ctx = SynchronizationContext.Current; // Save the new gesture name to gestureInfoNew.data string name = gestureName.Text; Gestures.addNewGesture(name); Gestures.saveData(GestureStudio.GesturesDataPathNew); Gestures.loadData(GestureStudio.GesturesDataPathNew); // Count down 5. int countDown = 5; System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Interval = 1000; timer.Tick += (o, src) => { countDown--; ctx.Post((state) => { this.countDownLabel.Text = countDown.ToString(); }, null); if (countDown == 0) { this.OnStart(); timer.Stop(); countDown = 5; this.countDownLabel.Text = countDown.ToString(); this.gestureName.Text = "Name of the new gesture."; } }; timer.Start(); }
void InternalInitialize(Action initializeCallback) { modelBuilder = new SvmModelBuilder(); this.featureVector = new List <double[]>(); // init omp this.imgFeature = new ImageFeature(GestureStudio.GestureLib_DictionartyPath); // update GestureInfo.data if (this.problemFile == null || this.problemFile.Equals(GestureStudio.FeatureFileEmpty)) { Gestures.loadData(GestureStudio.GesturesDataPathEmpty); } else if (this.problemFile.Equals(GestureStudio.FeatureFileNew)) { Gestures.loadData(GestureStudio.GesturesDataPathNew); } else // demo version, this will take a long time. So avoid this in the demo. { Gestures.loadData(GestureStudio.GesturesDataPathDemo); } // done initialization if (initializeCallback != null) { initializeCallback(); } // display trainer form SynchronizationContext ctx = SynchronizationContext.Current; GestureStudio.DisplayTrainerForm(() => { // count down finished, begin this.initialized = true; }); }