Exemplo n.º 1
0
        protected override void CustomUpdateMonitorReading(object sender, Ubicomp.Utils.NET.CAF.ContextAdapter.NotifyContextMonitorListenersEventArgs e)
        {
            if (e.Type != typeof(Bitmap))
            return;
              if (Device.State == StackingState.StackedOnTop)
            return;
              if (isProcessStopped)
            return;

              if (sender is SimCameraMonitor)
              {
            List<Glyph> detectedGlyphs = new List<Glyph>();
            var simulatorDevice = ((sender as SimCameraMonitor).CameraSource as SimulatorDevice).CalculatorGlyph;
            if (simulatorDevice == true)
              detectedGlyphs.Add(Glyph.Square);
            NotifyContextServiceListeners(this, new NotifyContextServiceListenersEventArgs(typeof(GlyphDetectionService), detectedGlyphs));
              }
              else if (sender is CameraMonitor)
              {
            if (Tracker == null)
              Tracker = (sender as CameraMonitor).Tracker;
            if (Tracker == null)
              return;

            List<Glyph> detectedGlyphs = new List<Glyph>();
            ManagedA.Glyphs result = Tracker.DetectFigures(20, 80, 150);
            for(int i = 0 ; i < result.numberSquares ; i++)
              detectedGlyphs.Add(Glyph.Square);
            for (int i = 0; i < result.numberTriangles; i++)
              detectedGlyphs.Add(Glyph.Triangle);

            NotifyContextServiceListeners(this, new NotifyContextServiceListenersEventArgs(typeof(GlyphDetectionService), detectedGlyphs));
              }
        }
Exemplo n.º 2
0
 public void StartFeatureTracker()
 {
     try
       {
     if (Tracker == null)
     {
       Matcher = new ManagedA.wrapperFeatureMatcher(false, Environment.CurrentDirectory + "\\" + CameraSource.ActualDocument.Folder);
       Tracker = new ManagedA.wrapperRegistClass(false, CameraSource.SimCaptureToSourceImageRatio, Matcher);
     }
     //Tracker.createIndex(Environment.CurrentDirectory + "\\" + Controller.ActualDocument.Folder);
     Tracker.computeWarpMatrix(CameraSource.SimCaptureToSourceImageRatio);
     isStarted = true;
       }
       catch { return; }
 }
Exemplo n.º 3
0
 public void StartFeatureTracker()
 {
     try
       {
     if (Tracker == null)
     {
       //create index of features
       Matcher = new ManagedA.wrapperFeatureMatcher(true, Environment.CurrentDirectory + "\\" + Controller.ActualDocument.Folder);
       // create tracker
       Tracker = new ManagedA.wrapperRegistClass(true, Controller.SimCaptureToSourceImageRatio, Matcher);
     }
     // compute warp matrix (once)
     Tracker.computeWarpMatrix("homography.xml");
     isStarted = true;
       }
       catch { return; }
 }
Exemplo n.º 4
0
        internal bool TryPort()
        {
            if (!useCamera)
            return false;

              try
              {
            if (Tracker == null)
            {
              Matcher = new ManagedA.wrapperFeatureMatcher(true, Environment.CurrentDirectory + "\\" + Controller.ActualDocument.Folder);
              Tracker = new ManagedA.wrapperRegistClass(true, Controller.SimCaptureToSourceImageRatio, Matcher);
            }
            if (Tracker.connectCamera() != -1)
              return true;
              }
              catch { return false; }

              return false;
        }