using LeatherApp.Utils; using OpenCvSharp; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace LeatherApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { Mat mat0 = Cv2.ImRead(this.textBox1.Text.Trim()); int marginWidth0; mat0 = OpenCVUtil.getMaxInsetRect2(mat0, true, 0, out marginWidth0); this.label1.Text = "边缘宽度:" + marginWidth0; } catch(Exception ex) { MessageBox.Show(ex.Message); } } } }