Backup/motion/MotionDetector3.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>
/// MotionDetector3
/// </summary>
public class MotionDetector3 : IMotionDetector
{
private IFilter grayscaleFilter = new GrayscaleBT709( );
private IFilter pixellateFilter = new Pixellate( );
private Difference differenceFilter = new Difference( );
private Threshold thresholdFilter = new Threshold( 15 );
private Dilatation dilatationFilter = new Dilatation( );
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 FiltersSequence processingFilter1 = new FiltersSequence( );
private FiltersSequence processingFilter2 = new FiltersSequence( );
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 MotionDetector3( )
{
processingFilter1.Add( grayscaleFilter );
后面还有 123 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。