Backup/motion/MotionDetector4.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// Motion Detector
//
// Copyright ?Andrew Kirillov, 2005
// andrew.kirillov@gmail.com
//
namespace motion
{
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using AForge.Imaging;
using AForge.Imaging.Filters;
/// <summary>
/// MotionDetector4
/// </summary>
public class MotionDetector4 : IMotionDetector
{
private IFilter grayscaleFilter = new GrayscaleBT709( );
private IFilter pixellateFilter = new Pixellate( );
private Difference differenceFilter = new Difference( );
private Threshold thresholdFilter = new Threshold( 15 );
private MoveTowards moveTowardsFilter = new MoveTowards( );
private FiltersSequence processingFilter1 = new FiltersSequence( );
private BlobCounter blobCounter = new BlobCounter( );
private Bitmap backgroundFrame;
private BitmapData bitmapData;
private int counter = 0;
private Bitmap[] numbersBitmaps = new Bitmap[9];
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 MotionDetector4( )
{
processingFilter1.Add( grayscaleFilter );
processingFilter1.Add( pixellateFilter );
// load numbers bitmaps
后面还有 102 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。