OpenCVSharp4を導入してみた

導入方法

1.Nugetで「OpenCvSharp4」と「OpenCvSharp4.runtime.win」の両方をインストールする。

 

f:id:negizoku:20200920224946p:plain

 

f:id:negizoku:20200920225003p:plain



2.以下のプログラムをテスト

using System;  
using OpenCvSharp;  

namespace 画像処理テスト {  
    class Program {  
        static void Main(string[] args) {  
            var str = new Mat("D:/picture/bTqb4E.jpg");  
            Mat imgGray = new Mat(str.Width, str.Height, MatType.CV_8UC1);  

            Cv2.CvtColor(str, imgGray, ColorConversionCodes.RGB2GRAY);  

            Cv2.ImShow("dst" ,imgGray);  
            Cv2.WaitKey();  
            Cv2.DestroyAllWindows();  
        }  
    }  
}  

参考

https://github.com/shimat/opencvsharp_samples/
https://tech-blog.s-yoshiki.com/2018/11/787/