public bool Detect(Frame frame, ref MotionDetectionResult result) { result.FrameGuid = _oldGuid; result.MotionRect = _oldCvRect; var ipl = frame.GetImage(); _oldCvRect = new CvRect(0, 0, ipl.Width, ipl.Height); _oldGuid = frame.Guid; return(true); }
public void Test() { IMotionDetector motiondetector = new FaceProcessingWrapper.MotionDetector(); foreach (var file in System.IO.Directory.GetFiles(@"M:\测试图片\Lb", "*.jpg")) { var ipl = OpenCvSharp.IplImage.FromFile(file); var frame = new Frame(ipl); MotionDetectionResult result = new MotionDetectionResult(); var groupCaptured = motiondetector.Detect(frame, ref result); System.Diagnostics.Debug.WriteLine(groupCaptured.ToString() + " " + result.MotionRect.Width); } }
public bool ProcessFrame(Frame frame) { try { frame.GetImage(); } catch (System.ArgumentException ex) { return false; } this._manager.AddNewFrame(frame); var oldFrameMotionResult = new MotionDetectionResult(); bool groupCaptured = ProcessNewFrame(frame, ref oldFrameMotionResult); ProcessOldFrame(oldFrameMotionResult); return groupCaptured; }
private void ProcessOldFrame(MotionDetectionResult result) { if (IsStaticFrame(result.MotionRect)) { this._manager.DisposeFrame(result.FrameGuid); } else { this._manager.MoveToMotionFrames(result); } }
private bool ProcessNewFrame(Frame frame, ref MotionDetectionResult detectionResult) { var result = CurrentMotionDetector.Detect(frame, ref detectionResult); return result; }