void camera_BitmapStreamed(GTM.GHIElectronics.Camera sender, Bitmap bitmap)
        {
            //320*240

            displayT35.SimpleGraphics.DisplayImage(bitmap, 0, 0);
            detectionMove(bitmap);
        }
Example #2
0
        /**
         * This method is triggered when an image is caught.
         */
        private void camera_PictureCaptured(GTM.GHIElectronics.Camera sender, GT.Picture picture)
        {
            if (throw_allarm || picture == null || !setupComplete)
            {
                return;
            }

            Int32  HeurSum = 0;
            Bitmap bitmapB = picture.MakeBitmap();

            Debug.Print("Image captured! ");
            try
            {
                if (contImage < 2)
                {
                    if (contImage == 0)
                    {
                        setupCameraTakePicture();
                    }
                    contImage++;
                    return;
                }

                if (bitmapA == null)    //per gestire la prima volta
                {
                    WindowsManager.showWindowInsertPin();
                    bitmapA         = bitmapB;
                    RGlobal         = heuristicSum(bitmapA);
                    PreviousAverage = RGlobal / 9;
                    sendPicture(picture.PictureData, true);
                    return;
                }

                Debug.Print(DateTime.Now.ToString());
                HeurSum = heuristicSum(bitmapB);
                Debug.Print(DateTime.Now.ToString());

                Debug.Print(PreviousAverage.ToString());
                Int32 average = (HeurSum / 9);
                Debug.Print(average.ToString());

                if (System.Math.Abs(PreviousAverage - average) > 45)    //SOGLIA LIMITE 40/50
                {
                    Debug.Print("Suspicious picture!");
                    sendPicture(picture.PictureData, false);
                }

                RGlobal         = HeurSum;
                PreviousAverage = average;

                //  displayT35.SimpleGraphics.DisplayImage(picture, 0, 0); //TODO eliminare alla fine
            }
            catch (SocketException e)
            {
                timer_getimage.Stop();
                timer_keepAlive.Stop();
                WindowsManager.showWindowErrorServer();
            }
        }
        public CameraClass(Gadgeteer.Modules.GHIElectronics.Camera camera, Motion_Sensor motion_Sensor, Wifi wf)
        {
            this.wifi = wf;
            this.camera = camera;
            this.camera.CurrentPictureResolution = Camera.PictureResolution.Resolution160x120;
            this.motion_Sensor = motion_Sensor;
            this.motion_Sensor.Motion_Sensed += new GTM.Motion_Sensor.Motion_SensorEventHandler(motion_Sensor_Motion_Sensed);
            this.camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
            this.camera.DebugPrintEnabled = false;

            timer = new GT.Timer(sleepTime);
            timer.Tick += timer_Tick;
        }
Example #4
0
        public CameraClass(Gadgeteer.Modules.GHIElectronics.Camera camera, Motion_Sensor motion_Sensor, Wifi wf)
        {
            this.wifi   = wf;
            this.camera = camera;
            this.camera.CurrentPictureResolution = Camera.PictureResolution.Resolution160x120;
            this.motion_Sensor = motion_Sensor;
            this.motion_Sensor.Motion_Sensed += new GTM.Motion_Sensor.Motion_SensorEventHandler(motion_Sensor_Motion_Sensed);
            this.camera.PictureCaptured      += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
            this.camera.DebugPrintEnabled     = false;

            timer       = new GT.Timer(sleepTime);
            timer.Tick += timer_Tick;
        }
Example #5
0
 private void camera_BitmapStreamed(GTM.GHIElectronics.Camera sender, Bitmap e)
 {
     if (invalidate)
     {
         /*
          * timer_progress.Stop();
          * Thread.Sleep(100);
          * progress.Value = 100;
          * progress.Invalidate();
          * */
         invalidate = false;
         setupJoystick();
     }
     Debug.Print("Refresh streaming");
     if (NetworkUp && !setupComplete && !serverUnreacheable && streaming)
     {
         displayT35.SimpleGraphics.DisplayImage(e, 0, 0);
     }
 }
Example #6
0
 private void PictureCaptured(GHIE.Camera camera, GT.Picture picture)
 {
     Debug.Print("picture captured");
     sdCard.SavePicture(sessionDate + "\\" + sessionDate + " " + GetSessionTime() + ".bmp", picture);
 }