Example #1
0
        // Open video source
        private void OpenVideoSource(IVideoSource source)
        {
            // set busy cursor
            this.Cursor = Cursors.WaitCursor;

            // close previous file
            CloseVideoSource();

            //source.VideoSourceError += new VideoSourceErrorEventHandler(source_VideoSourceError);
            // create camera
            Camera camera = new Camera(source);

            // attach camera to camera window
            cameraWindow.Camera = camera;

            // start camera
            camera.Start();
            //timer.Start();

            this.Cursor = Cursors.Default;
        }
Example #2
0
        // Open video source
        private void OpenVideoSource(IVideoSource source)
        {
            // set busy cursor
            this.Cursor = Cursors.WaitCursor;

            // close previous file
            CloseVideoSource();

            source.VideoSourceError += new VideoSourceErrorEventHandler(source_VideoSourceError);
            // create camera
            Camera camera = new Camera(source, mMotionDetector);
            camera.CameraClass = this.CameraClass;
            if (camera.MotionDetector is ObjectMotionDetector)
            {
                ObjectMotionDetector m = camera.MotionDetector as ObjectMotionDetector;
                m.MinObjectDimension = (int)this.CameraClass.Sensibility;
                m.MotionZone = this.CameraClass.CameraRegions;
            }

            // start camera
            camera.Start();

            // attach camera to camera window
            cameraWindow.Camera = camera;

            // reset statistics
            mStat.Reset();

            // set event handlers
            camera.NewFrame += new AForge.Video.NewFrameEventHandler(camera_NewFrame);
            camera.Alarm += new EventHandler(camera_Alarm);

            // start timer
            timer.Start();

            this.Cursor = Cursors.Default;
        }