motion/MotionDetector3Optimized.cs

(开头部分) 6KB

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

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

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

	/// <summary>
	/// MotionDetector3Optimized
	/// </summary>
	public class MotionDetector3Optimized : IMotionDetector
	{
		private byte[]	backgroundFrame = null;
		private byte[]	currentFrame = null;
		private byte[]	currentFrameDilatated = null;

		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 MotionDetector3Optimized( )
		{
		}

		// Reset detector to initial state
		public void Reset( )
		{
			backgroundFrame = null;
			currentFrame = null;
			currentFrameDilatated = null;
			counter = 0;
		}

		// Process new frame
		public void ProcessFrame( ref Bitmap image )
		{
后面还有 225 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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