public FaceSearchController( IFrameStream source, IOperation<Frame> frameProcessor, IConvertor<Frame, Portrait> convertor, IOperation<Portrait> portraitProcessor) { _source = source; _frameProcessor = frameProcessor; _convertor = convertor; _portraitProcessor = portraitProcessor; _worker.DoWork = delegate { var frames = frameProcessor.Execute(null).ToList(); var portraits = _convertor.Execute(frames).ToList(); var portraitsAfterProcess = _portraitProcessor.Execute(portraits).ToList(); foreach (var portrait in portraitsAfterProcess) { portrait.Dispose(); } }; _worker.OnExceptionRetry = () => _source.Connect(); }
public FaceSearchController( IFrameStream source, IOperation <Frame> frameProcessor, IConvertor <Frame, Portrait> convertor, IOperation <Portrait> portraitProcessor) { _source = source; _frameProcessor = frameProcessor; _convertor = convertor; _portraitProcessor = portraitProcessor; _worker.DoWork = delegate { var frames = frameProcessor.Execute(null).ToList(); var portraits = _convertor.Execute(frames).ToList(); var portraitsAfterProcess = _portraitProcessor.Execute(portraits).ToList(); foreach (var portrait in portraitsAfterProcess) { portrait.Dispose(); } }; _worker.OnExceptionRetry = () => _source.Connect(); }
private static Damany.Util.PersistentWorker CreateDriver(IFrameStream source, MotionDetector motionDetector) { var retriever = new Damany.Util.PersistentWorker(); retriever.OnWorkItemIsDone += item => { Console.Write("\r"); Frame f = item as Frame; Console.Write(f.ToString()); }; retriever.DoWork = delegate { var frame = source.RetrieveFrame(); retriever.ReportWorkItem(frame); motionDetector.DetectMotion(frame); }; retriever.OnExceptionRetry = delegate { source.Connect(); }; return retriever; }
private static Damany.Util.PersistentWorker CreateDriver(IFrameStream source, MotionDetector motionDetector) { var retriever = new Damany.Util.PersistentWorker(); retriever.OnWorkItemIsDone += item => { Console.Write("\r"); Frame f = item as Frame; Console.Write(f.ToString()); }; retriever.DoWork = delegate { var frame = source.RetrieveFrame(); retriever.ReportWorkItem(frame); motionDetector.DetectMotion(frame); }; retriever.OnExceptionRetry = delegate { source.Connect(); }; return(retriever); }