private void ButtonCustom_Click(object sender, RoutedEventArgs e) { if (!CheckImage()) return; var a = new RS_Diag.UserDef(); if (a.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; _loading.Start(); // 以下很慢…… var cho = _image[_fChoose.ChoosedFile]; var knl = a.Kernel; RS_Lib.Conv[] c = new Conv[cho.BandsCount]; for (int i = 0; i < c.Length; i++) { c[i] = new Conv(cho.GetPicData(i + 1), knl); } byte[,,] tmp = new byte[cho.BandsCount, cho.Lines, cho.Samples]; for (int i = 0; i < tmp.GetLength(0); i++) { var tt = c[i].GetLinearStretch(); for (int j = 0; j < tmp.GetLength(1); j++) { for (int k = 0; k < tmp.GetLength(2); k++) { tmp[i, j, k] = tt[j, k]; } } } AddNewPic(tmp, cho.FileName + "-自定义卷积核", false); _loading.Abort(); }
private void ButtonCustom_Click(object sender, RoutedEventArgs e) { if (!CheckImage()) { return; } var a = new RS_Diag.UserDef(); if (a.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } _loading.Start(); // 以下很慢…… var cho = _image[_fChoose.ChoosedFile]; var knl = a.Kernel; RS_Lib.Conv[] c = new Conv[cho.BandsCount]; for (int i = 0; i < c.Length; i++) { c[i] = new Conv(cho.GetPicData(i + 1), knl); } byte[,,] tmp = new byte[cho.BandsCount, cho.Lines, cho.Samples]; for (int i = 0; i < tmp.GetLength(0); i++) { var tt = c[i].GetLinearStretch(); for (int j = 0; j < tmp.GetLength(1); j++) { for (int k = 0; k < tmp.GetLength(2); k++) { tmp[i, j, k] = tt[j, k]; } } } AddNewPic(tmp, cho.FileName + "-自定义卷积核", false); _loading.Abort(); }