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

            motionDetector = new MotionDetector(detectionAlgorithm, processingAlgorithm);

            motionLevels = new BlockingCollection <Motion>(new ConcurrentQueue <Motion>());
        }
Example #2
0
        public MotionDetect(int webcamID)
        {
            VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            FinalVideo          = new VideoCaptureDevice(VideoCaptureDevices[webcamID].MonikerString);
            var motionProcessor = new MotionAreaHighlighting();

            Detector             = new MotionDetector(new TwoFramesDifferenceDetector(), motionProcessor);
            FinalVideo.NewFrame += FinalVideo_NewFrame;
        }
Example #3
0
        /// <summary>
        /// Initialize sensor
        /// </summary>
        private void init()
        {
            try
            {
                if (isLocalCamera)
                {
                    var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                    video = new VideoCaptureDevice(videoDevices[localCameraIndex].MonikerString);
                }
                else
                {
                    video = new MJPEGStream(this.cameraUrl);
                    ((MJPEGStream)video).Login    = this.cameraLogin;
                    ((MJPEGStream)video).Password = this.cameraPassword;
                }
                video.NewFrame         += new NewFrameEventHandler(processFrame);
                video.VideoSourceError += new VideoSourceErrorEventHandler(processFrameError);

                motionMarker = new MotionAreaHighlighting();

                motion = new MotionDetector(
                    new SimpleBackgroundModelingDetector(),
                    motionMarker
                    );

                detectorFace        = Detector.Face();
                detectorEye         = Detector.Eye();
                detectorNose        = Detector.Nose();
                detectorEarLeft     = Detector.EarLeft();
                detectorEarRight    = Detector.EarRight();
                detectorFaceProfile = Detector.FaceProfile();
            }
            catch (Exception ex)
            {
                updateError(ex.Message);
            }
        }