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> /// Laplacian算子 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLaplacian_Click(object sender, EventArgs e) { // 加载图像 Mat src = Cv2.ImRead(@"img\star.png", ImreadModes.Grayscale); Cv2.ImShow("原图", src); Mat dst = new Mat(); Mat abs_dst = new Mat(); Cv2.Laplacian(src, dst, MatType.CV_16S, 3, 1, 0, BorderTypes.Default); Cv2.ConvertScaleAbs(dst, abs_dst); Cv2.ImShow("Laplacian算子", abs_dst); } } }