private void detectBtn_Click(object sender, EventArgs e) { if (ocrEngin == null) { MessageBox.Show("未初始化,无法执行!"); return; } string targetImg = pathTextBox.Text; if (!File.Exists(targetImg)) { MessageBox.Show("目标图片不存在,请用Open按钮打开"); return; } int padding = (int)paddingNumeric.Value; int imgResize = (int)imgResizeNumeric.Value; float boxScoreThresh = (float)boxScoreThreshNumeric.Value; float boxThresh = (float)boxThreshNumeric.Value; float unClipRatio = (float)unClipRatioNumeric.Value; bool doAngle = doAngleCheckBox.Checked; bool mostAngle = mostAngleCheckBox.Checked; OcrResult ocrResult = ocrEngin.Detect(pathTextBox.Text, padding, imgResize, boxScoreThresh, boxThresh, unClipRatio, doAngle, mostAngle); ocrResultTextBox.Text = ocrResult.ToString(); strRestTextBox.Text = ocrResult.StrRes; pictureBox.Image = ocrResult.BoxImg.ToBitmap(); }