Backup/motion/MotionDetector2.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// Motion Detector
//
// Copyright ?Andrew Kirillov, 2005-2006
// andrew.kirillov@gmail.com
//
namespace motion
{
	using System;
	using System.Drawing;
	using System.Drawing.Imaging;

	using AForge.Imaging;
	using AForge.Imaging.Filters;

	/// <summary>
	/// MotionDetector2
	/// </summary>
	public class MotionDetector2 : IMotionDetector
	{
		private IFilter	grayscaleFilter = new GrayscaleBT709( );
		private Difference differenceFilter = new Difference( );
		private Threshold thresholdFilter = new Threshold( 15 );
		private IFilter openingFilter = new Opening( );
		private IFilter edgesFilter = new Edges( );
		private Merge mergeFilter = new Merge( );

		private IFilter extrachChannel = new ExtractChannel( RGB.R );
		private ReplaceChannel replaceChannel = new ReplaceChannel( RGB.R, null );
		private MoveTowards moveTowardsFilter = new MoveTowards( );

		private Bitmap	backgroundFrame;
        private BitmapData bitmapData;
        private int counter = 0;

		private bool	calculateMotionLevel = false;
		private int		width;	// image width
		private int		height;	// image height
		private int		pixelsChanged;

		// Motion level calculation - calculate or not motion level
		public bool MotionLevelCalculation
		{
			get { return calculateMotionLevel; }
			set { calculateMotionLevel = value; }
		}

		// Motion level - amount of changes in percents
		public double MotionLevel
		{
			get { return (double) pixelsChanged / ( width * height ); }
		}

		// Constructor
		public MotionDetector2( )
		{
		}

		// Reset detector to initial state
		public void Reset( )
		{
后面还有 107 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。