2020-09-20 OpenCVSharp4でwebカメラを使ってみた OpenCVSharp 画像処理 はじめに OpenCVを使ってwebカメラをとりあえず使ってみたかった using System; using OpenCvSharp; using OpenCvSharp.Extensions; namespace カメラテスト { class Program { static void Main(string[] args) { var capture = new VideoCapture(0); int fps = 30; int sleepTime = (int)Math.Round((decimal)1000 / fps); using(var window = new Window("capture")) { Mat img = new Mat(); while(true) { capture.Read(img); if(img.Empty()) break; window.ShowImage(img); Cv2.WaitKey(sleepTime); } } } } } C# 参考 https://github.com/shimat/opencvsharp_samples/