// Play around with this function to tweak results. public static AForge.Vision.Motion.MotionDetector GetDefaultMotionDetector() { AForge.Vision.Motion.IMotionDetector detector = null; AForge.Vision.Motion.IMotionProcessing processor = null; AForge.Vision.Motion.MotionDetector motionDetector = null; detector = new AForge.Vision.Motion.TwoFramesDifferenceDetector() { DifferenceThreshold = 15, SuppressNoise = true }; //detector = new AForge.Vision.Motion.CustomFrameDifferenceDetector() //{ // DifferenceThreshold = 15, // KeepObjectsEdges = true, // SuppressNoise = true //}; //processor = new AForge.Vision.Motion.GridMotionAreaProcessing() //{ // HighlightColor = System.Drawing.Color.Red, // HighlightMotionGrid = true, // GridWidth = 100, // GridHeight = 100, // MotionAmountToHighlight = 100F //}; /* * processor = new AForge.Vision.Motion.MotionAreaHighlighting() * { * HighlightColor = System.Drawing.Color.Red, * }; * */ motionDetector = new AForge.Vision.Motion.MotionDetector(detector); return(motionDetector); }
// Play around with this function to tweak results. public static AForge.Vision.Motion.MotionDetector GetDefaultMotionDetector() { AForge.Vision.Motion.IMotionDetector detector = null; AForge.Vision.Motion.IMotionProcessing processor = null; AForge.Vision.Motion.MotionDetector motionDetector = null; detector = new AForge.Vision.Motion.TwoFramesDifferenceDetector() { DifferenceThreshold = 15, SuppressNoise = true }; //detector = new AForge.Vision.Motion.CustomFrameDifferenceDetector() //{ // DifferenceThreshold = 15, // KeepObjectsEdges = true, // SuppressNoise = true //}; //processor = new AForge.Vision.Motion.GridMotionAreaProcessing() //{ // HighlightColor = System.Drawing.Color.Red, // HighlightMotionGrid = true, // GridWidth = 100, // GridHeight = 100, // MotionAmountToHighlight = 100F //}; /* processor = new AForge.Vision.Motion.MotionAreaHighlighting() { HighlightColor = System.Drawing.Color.Red, }; * */ motionDetector = new AForge.Vision.Motion.MotionDetector(detector); return (motionDetector); }