Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            detector       = new MotionDetector(new TwoFramesDifferenceDetector(), new MotionBorderHighlighting());
            detectionLevel = 0;

            devices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            foreach (FilterInfo d in devices)
            {
                comboBox1.Items.Add(d.Name);
            }
            comboBox1.SelectedIndex = 0;
        }
Esempio n. 2
0
        public CameraManager(Game game) : base(game)
        {
            //Hack
            //fball = ((Game1)game).Fball;
            PlayerFace = ((Game1)game).FaceTracker;
            fbm        = ((Game1)game).FBM;

            gameConsole = (GameConsole)game.Services.GetService(typeof(IGameConsole));

            this.LFaces = new List <PlayerFace>();

            //try to create the capture
            if (_capture == null)
            {
                try
                {
                    //gameConsole.GameConsoleWrite("Camera intialized:" + _capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FORMAT).ToString());
                    _capture = new Capture();

                    //240 X 90

                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 160);
                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 120);

                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 240);
                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 90);

                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 320);
                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 240);

                    _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 720);
                    _capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 405);
                    //_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS, 15);

                    gameConsole.GameConsoleWrite("Camera FPS:" + _capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS).ToString());
                    gameConsole.GameConsoleWrite("Camera WIDTH:" + _capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH).ToString());
                    gameConsole.GameConsoleWrite("Camera HEIGHT:" + _capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT).ToString());
                }
                catch (NullReferenceException excpt)
                {   //show errors if there is any
                    throw excpt;
                }
            }
            this.UpdateCameraFrameInterval         = 400;
            this.UpdateFaceFrameInterval           = this.UpdateCameraFrameInterval + 0;
            this.UpdateMotionDetectorFrameInterval = this.UpdateCameraFrameInterval + 0;
            fd = new FaceDetector();
            md = new MotionDetector(game);

            input       = (InputHandler)game.Services.GetService(typeof(IInputHandler));
            gameConsole = (GameConsole)game.Services.GetService(typeof(IGameConsole));
        }
Esempio n. 3
0
 private void ResetDetector()
 {
     _processor = new GridMotionAreaProcessing(DetectorConfiguration.Size, DetectorConfiguration.Size);
     _processor.MotionAmountToHighlight = DetectorConfiguration.Sensitivity;
     _motionDetector = new MotionDetector(new SimpleBackgroundModelingDetector(), _processor);
 }