private void ProcessingThread_DoWork()
        {
            while (true)
            {
                BaseFrame frame = imageStream.GetFrame();
                try
                {
                    if (frame != null)
                    {
                        Bitmap            bitmap = frame.GetBMP();
                        Image <Bgr, Byte> image  = new Image <Bgr, byte>(bitmap);

                        List <DetectedDoor>   doors = GetDoors(image);
                        DoorDetectedEventArgs args  = new DoorDetectedEventArgs(doors, DetectedDoor.DetectMethod.COLOR);
                        if (OnDoorDetected != null)
                        {
                            OnDoorDetected(this, args);
                        }
                    }
                    Thread.Sleep(UPDATE_INTERVAL);
                }
                catch (Exception e)
                {
                    //
                }
            }
        }
示例#2
0
        /// <summary>
        /// Watches for obstacles.
        /// </summary>
        public void Watch()
        {
            // TODO : Obstacle detection
            // Check whether the thread has previously been named
            // to avoid a possible InvalidOperationException.
            this.watchThread.Name = "ObstructionThread";

            while (true)
            {
                DFrame myFrame = (DFrame)vision.GetFrame();

                Detect(myFrame);
                Thread.Sleep(200);
            }
        }
        private void ProcessingThread_DoWork()
        {
            while (true)
            {
                Bitmap            bitmap = imageStream.GetFrame().GetBMP();
                Image <Bgr, Byte> image  = new Image <Bgr, byte>(bitmap);

                List <DetectedDoor>   doors = GetDoors(image);
                DoorDetectedEventArgs args  = new DoorDetectedEventArgs(doors, DetectedDoor.DetectMethod.COMPOSITE);
                if (OnDoorDetected != null)
                {
                    OnDoorDetected(this, args);
                }

                Thread.Sleep(UPDATE_INTERVAL);
            }
        }
 private void ProcessingThread_DoWork()
 {
     while (true)
     {
         BaseFrame frame  = imageStream.GetFrame();
         DFrame    dFrame = (DFrame)frame;
         if (dFrame != null)
         {
             List <DetectedDoor>   doors = GetDoors(dFrame);
             DoorDetectedEventArgs args  = new DoorDetectedEventArgs(doors, DetectedDoor.DetectMethod.DEPTH);
             if (OnDoorDetected != null)
             {
                 OnDoorDetected(this, args);
             }
         }
         Thread.Sleep(UPDATE_INTERVAL);
     }
 }