public override IObservable <IplImage> Process(IObservable <IplImage> source) { return(source.Select(input => { var output = new IplImage(input.Size, IplDepth.U8, 1); CV.Canny(input, output, Threshold1, Threshold2, ApertureSize); return output; })); }
public static void GrayCapture(Capture capture) { using (var window = new NamedWindow("test")) { while (CV.WaitKey(10) < 0) //laisse la main { using (var src = capture.QueryFrame()) // recupere une image { if (src == null) { break; } using (var gray = new IplImage(src.Size, IplDepth.U8, 1)) //filtre using (var dstCanny = new IplImage(src.Size, IplDepth.U8, 1)) { CV.CvtColor(src, gray, ColorConversion.Bgr2Gray); CV.Canny(gray, dstCanny, 50, 50); window.ShowImage(dstCanny); } } } } }
static void Main(string[] args) { //détourage using (var capture = Capture.CreateCameraCapture(0)) { using (var window = new NamedWindow("test")) { while (CV.WaitKey(10) < 0) //laisse la main { using (var src = capture.QueryFrame()) // recupere une image using (var gray = new IplImage(src.Size, IplDepth.U8, 1)) //filtre using (var dstCanny = new IplImage(src.Size, IplDepth.U8, 1)) { CV.CvtColor(src, gray, ColorConversion.Bgr2Gray); CV.Canny(gray, dstCanny, 50, 50); window.ShowImage(dstCanny); } } } } //var fileCapture = Capture.CreateFileCapture("/path/to/your/video/test.avi"); }