安装:
右键项目找到nuget。(博主用的vs2019)
安装opencvsharp(因为是win10系统所以需要装runtime.win)
检查依赖项
using OpenCvSharp;
using System;
namespace Test_opencvsharp
{
class Program
{
static void Main()
{
Mat src = new Mat("test.jpg", ImreadModes.Grayscale);
// Mat src = Cv2.ImRead("lenna.png", ImreadModes.GrayScale);
Mat dst = new Mat();
Cv2.Canny(src, dst, 50, 200);
using (new Window("src image", src))
using (new Window("dst image", dst))
{
Cv2.WaitKey();
}
}
}
}
测试结果(顺便夸一句耶啵牙口真好):