/****************************************/
        /****  Public Methods                ****/
        /****************************************/

        public Dictionary <int, List <double> > Run(string videoFileName, Config config)
        {
            m_MotionLevel            = new Dictionary <int, List <double> >();
            m_Detector               = new TwoFramesDifferenceDetector();
            m_Detector.SuppressNoise = true;
            m_OutFolder              = config.OutFolder;
            if (!m_OutFolder.EndsWith("\\"))
            {
                m_OutFolder = m_OutFolder + "\\";
            }

            m_FrameIndex = 0;
            m_Config     = config;
            m_DoneEvent  = new AutoResetEvent(false);

            m_VideoSource                  = new Accord.Video.DirectShow.FileVideoSource(videoFileName);
            m_VideoSource.NewFrame        += NewFrame;
            m_VideoSource.PlayingFinished += PlayingFinished;
            m_VideoSource.Start();

            /*m_FVideoSource = new Accord.Video.FFMPEG.VideoFileSource(videoFileName);
             * m_FVideoSource.NewFrame += NewFrame;
             * m_FVideoSource.PlayingFinished += PlayingFinished;
             * m_FVideoSource.Start();*/

            m_DoneEvent.WaitOne();

            return(m_MotionLevel);
        }
        MotionSensor()
        {
            var detectionAlgorithm  = new TwoFramesDifferenceDetector(true);
            var processingAlgorithm = new MotionAreaHighlighting();

            motionDetector = new MotionDetector(detectionAlgorithm, processingAlgorithm);

            motionLevels = new BlockingCollection <Motion>(new ConcurrentQueue <Motion>());
        }
Exemple #3
0
        public MainForm()
        {
            InitializeComponent();

            videoWriter = new VideoFileWriter();
            camera      = new VideoCaptureDevice();

            var detector = new TwoFramesDifferenceDetector(true);

            motionDetector = new MotionDetector(detector, new MotionAreaHighlighting());
        }
Exemple #4
0
        public ROI(BH.oM.Geometry.Point start, BH.oM.Geometry.Point end)
        {
            mStartCorner  = start;
            mEndCorner    = end;
            _cutRect      = new RectangleF(StartPointS.X, StartPointS.Y, (float)Width, (float)Height);
            _id           = Guid.NewGuid();
            _motionLevels = new Dictionary <int, double>();

            _detector = new TwoFramesDifferenceDetector();
            _detector.SuppressNoise = true;

            _humanID = -1;
        }
        public void Analyse(String folderName)
        {
            _outputFolder = folderName;
            try
            {
                _doneEvent = new AutoResetEvent(false);
                _detector  = new TwoFramesDifferenceDetector();
                _detector.SuppressNoise = true;
                _frameIndex             = 0;

                _video                  = new FileVideoSource(_fileName);
                _video.NewFrame        += new Accord.Video.NewFrameEventHandler(Video_NewFrame);
                _video.PlayingFinished += Video_PlayingFinished;

                _video.Start();

                _firstFrameFlag = false;

                _doneEvent.WaitOne();
            }
            catch { }
        }