using OpenCvSharp; using OpenCvSharp.Extensions; using DlibDotNet; 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; using System.Threading; namespace app { public partial class FrmMain : Form { public FrmMain() { InitializeComponent(); } /// <summary> /// 放大 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnResizeBig_Click(object sender, EventArgs e) { Mat src = Cv2.ImRead(@"img\jzh.png"); Mat dest = new Mat(); Cv2.Resize(src, dest, new OpenCvSharp.Size(src.Cols * 2, src.Rows * 2), 0, 0, InterpolationFlags.Linear); Cv2.ImShow("src", src); Cv2.ImShow("放大", dest); } /// <summary> /// 缩小 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnResizeSmall_Click(object sender, EventArgs e) { Mat src = Cv2.ImRead(@"img\jzh.png"); Mat dest = new Mat(); Cv2.Resize(src, dest, new OpenCvSharp.Size(src.Cols / 2, src.Rows / 2), 0, 0, InterpolationFlags.Linear); Cv2.ImShow("src", src); Cv2.ImShow("缩小", dest); } } }