//load on request public List <UKI_DataRaw> getDataRaw(Boolean extraFeature) { if (this.data_raw.Count == 0) { this.data_raw = TheUKI.csv_loadFileTo_DataRaw(path, skip); } if (extraFeature_isAvailable == false) { TheUKI.DataRaw_AddExtraFeature(this.data_raw); extraFeature_isAvailable = true; } return(this.data_raw); }
//Motion Recognition private void butMR_test_Click(object sender, RoutedEventArgs e) { try { String path_RawData; foreach (DataRow r in dataTable.Rows) { try { path_RawData = r[col_path].ToString(); string folderName = TheTool.getFileName_byPath(path_RawData); UKI_Offline mr = new UKI_Offline(); mr.UKI_OfflineProcessing(TheUKI.csv_loadFileTo_DataRaw(path_RawData, 0), 1); mr.data.exportFile(folderName, "UKI_", true, true, false); } catch (Exception ex) { TheSys.showError(r[col_path].ToString() + " : " + ex.ToString()); } } System.Windows.MessageBox.Show(@"Save to file", "Export Data"); } catch (Exception ex) { TheSys.showError(ex); } }
//Motion Analysis on 1 File //All Data (Whole Sequence) - All Motion //Output: Matrix static public string motionAnalysis(String path_load, String path_save, List <m_Motion> list_motions) { string currentFileName = TheTool.getFileName_byPath(path_load); string matrix_data = currentFileName; List <UKI_DataRaw> list_raw = TheUKI.csv_loadFileTo_DataRaw(path_load, 0); List <logDetection> log_list = new List <logDetection>();//keep output summary //--- Preprocess to obtain BasePosture Data UKI_Offline mr = new UKI_Offline(); mr.UKI_OfflineProcessing(list_raw, 0); List <UKI_Data_AnalysisForm> data = TheUKI.getData_AnalysisForm(mr.data.data_raw, mr.data.data_bp); //--- Analysis Motion by Motion foreach (m_Motion motion in list_motions) { Boolean detected = TheRuleTester.testDetectMotion(data, motion.inputs); logDetection log = TheRuleTester.temp_log; // log.info = motion.name + " ( " + log.info + " )"; if (detected) { log.info = "[" + log.detectAt + "] " + log.info; } else { log.info = "[X] " + log.info; } log_list.Add(log); matrix_data += "," + TheTool.convertBoolean_01(detected); } //-------------------------------- TheSys.showError("File: " + currentFileName); foreach (logDetection s in log_list.OrderBy(o => o.detectAt).ThenBy(o => o.num_pose)) { TheSys.showError(s.info); } TheSys.showError("---------------------"); return(matrix_data); }
private void butBrowse_Click(object sender, RoutedEventArgs e) { Nullable <bool> openDialog = TheTool.openFileDialog_01(false, ".*", ""); if (openDialog == true && TheTool.dialog.FileNames.Count() > 0) { this.fileFullPath = TheTool.dialog.FileNames[0]; this.fileFolder = System.IO.Path.GetDirectoryName(fileFullPath); this.fileName = TheTool.getFileName_byPath(fileFullPath); Title = TheTool.getFileName_byPath(fileName); List <UKI_DataRaw> data = new List <UKI_DataRaw>(); if (TheTool.getExtension_byPath(this.fileFullPath) == ".csv") { data.AddRange(TheUKI.csv_loadFileTo_DataRaw(fileFullPath, 0)); if (checkFPSauto.IsChecked.Value) { txtFPS.Text = "20"; } } else if (TheTool.getExtension_byPath(this.fileFullPath) == ".bvh") { data.AddRange(TheConverter.BVH_convert(fileFullPath)); TheUKI.saveData_Raw(fileFolder + @"/" + fileName + "(copy).csv", data); if (checkFPSauto.IsChecked.Value) { txtFPS.Text = "120"; } } if (checkCamera.IsChecked.Value) { data = TheUKI.UKI_DataRaw_centerize(data, 3); } loadData(data); txtMark.Text = ""; mark_count = 0; } }
private void butUKIconvert_Click(object sender, RoutedEventArgs e) { String fileName; String path_raw; String path_raw_centered; String path_ang; String path_ang_en; String path_raw_en; String path_dist_en; int ang_techq = comboAngTech.SelectedIndex; //center of angle int center_techq = comboRawCenter.SelectedIndex; //center of body position foreach (DataRow r in dataTable.Rows) { path_raw = r[col_path].ToString(); fileName = TheTool.getFileName_byPath(path_raw); TheTool.Folder_CreateIfMissing(path_folder_convert + fileName); String path_sub_folder = path_folder_convert + fileName + @"\"; path_raw_centered = path_sub_folder + fileName + " (center" + TheUKI.getCenterTechqName(center_techq) + ").csv"; path_ang = path_sub_folder + fileName + " ANG(" + TheUKI.getAngTechqName(ang_techq) + ").csv"; path_ang_en = path_sub_folder + fileName + " ANG_Entropy.csv"; path_raw_en = path_sub_folder + fileName + " RAW_Entropy.csv"; path_dist_en = path_sub_folder + fileName + " Dist_Entropy.csv"; if (center_techq > 0) { path_raw_en = path_sub_folder + fileName + " (center" + TheUKI.getCenterTechqName(center_techq) + ") RAW_Entropy.csv"; } //----- Raw ----- List <UKI_DataRaw> list_raw = TheUKI.csv_loadFileTo_DataRaw(path_raw, 0); //----- Angle --------- List <UKI_DataAngular> list_ang = TheUKI.calAngle_fromRaw(list_raw, ang_techq); if (checkUKI_Angle.IsChecked.Value || checkUKI_E_Angle.IsChecked.Value) { TheUKI.saveData_Ang(path_ang, list_ang); } //--------------------- //List<int> keyPostureId = UKI_getKeyPostureId(); List <int[]> keyPostureRange = ThePosExtract.getKetPose_Range_from1String(txtUKI_keyID.Text); //----- Angle Entropy --------- if (checkUKI_E_Angle.IsChecked.Value) { ThePosExtract.UKI_CalEntropy_Angle(path_ang_en, path_ang, keyPostureRange); } //----- Dist --------- if (checkUKI_E_Dist.IsChecked.Value) { ThePosExtract.UKI_CalEntropy_Eu(path_dist_en, path_raw, keyPostureRange); } //----- XYZ Entropy --------- if (checkUKI_E_XYZ.IsChecked.Value) { if (center_techq > 0) { List <UKI_DataRaw> list_raw_centered = TheUKI.raw_centerBodyJoint(list_raw, center_techq); TheUKI.saveData_Raw_centered(path_raw_centered, list_raw_centered, center_techq); ThePosExtract.UKI_CalEntropy_1By1(path_raw_en, path_raw_centered, keyPostureRange); } else { ThePosExtract.UKI_CalEntropy_1By1(path_raw_en, path_raw, keyPostureRange); } } } System.Windows.MessageBox.Show(@"Save to file\[Convert]"); }