예제 #1
0
 public GrayScanTask(Window window, CaptureCamera captureCamera, Projector projector)
     : base(window)
 {
     CaptureCamera = captureCamera;
     Projector = projector;
     Projector.Scene = new Scene(new ScreenCamera(Projector.Window));
 }
예제 #2
0
 public ChessboardSearchTask(Window window, CaptureCamera captureCamera, Chessboard chessboard)
     : base(window)
 {
     CaptureCamera = captureCamera;
     Chessboard = chessboard;
     WriteLine("Taking Snapshot");
 }
예제 #3
0
 public NullProjector(Window window)
     : base("Null", "N/A", new Size(256, 256), new PointF(128, 128), 128)
 {
     Color = Color.Pink;
     Scene = new Scene(ViewProject.Identity);
     Window = window;
 }
예제 #4
0
 public ChessboardShapeTask(Window window, Projector projector, Chessboard chessboard)
     : base(window)
 {
     Projector = projector;
     Chessboard = chessboard;
     ColoredChessboard = new ColoredChessboard(Chessboard, Color.Black, Color.White);
     LoadOrDefault(projector.Window.ClientSize);
 }
예제 #5
0
        public static void Run(string name, Func<Task> work)
        {
            Debug.Assert(Windows.IsEmpty());

            Monitor = new Window(name);
            Monitor.Load += (s, e) => Begin(work).ContinueWith(End);

            Application.Run(Monitor);
        }
예제 #6
0
        public RealProjector(string name, string uuid, Size imageSize, PointF principal, double focalLength, Screen screen)
            : base(name, uuid, imageSize, principal, focalLength)
        {
            Window = new Window("Pentacorn Projector")
            {
                LocatedOnScreen = screen,
                FullScreen = true,
            };

            Color = Color.DarkBlue;
            Window.Scene = new Scene(new ScreenCamera(Window)) { new Clear(Color.White), };
        }
예제 #7
0
        public VirtualProjector(Window window, OrbitCamera orbitCamera)
            : base("Null", "N/A", orbitCamera.Intrinsics.ImageSize, orbitCamera.Intrinsics.PrincipalPoint, orbitCamera.Intrinsics.FocalLength)
        {
            Color = Color.Yellow;
            Scene = new Scene(ViewProject.Identity);
            Window = window;

            View = orbitCamera.View;
            World = orbitCamera.World;

            OrbitCamera = orbitCamera;
        }
        public CalibrateIndirectlyTask(Window window, IEnumerable<CaptureCamera> captureCameras, Projector projector, Chessboard chessboard)
            : base(window)
        {
            CaptureCameras = captureCameras;
            Chessboard = chessboard;
            Projector = projector;

            ProjectorQuadCorners = Chessboard.GetDefaultImageQuadCorners(projector.Window.ClientSize);
            WorldToProjectorHom = Chessboard.GetHomographyTo(ProjectorQuadCorners);
            ColoredChessboard = new ColoredChessboard(Chessboard, Color.Black, Color.White, WorldToProjectorHom.ToMatrixFromHomogeneous3x3());

            Circles = Chessboard.Saddles.Select(s => new Circle2D(s.ToVector3(z: 0.01f), 10, 4, Color.Crimson) { AlreadyInScreenSpace = false } ).ToList();
        }
예제 #9
0
        public static IDisposable AttachInputToCamera(IObservable<Input> whenInput, Window window, OrbitCamera camera)
        {
            var whenFocusedInput = whenInput.Where(input => window.Focused);

            var whenLeftMouseDown = whenFocusedInput.Where(input => input.LeftMouseDown);
            var whenLeftMouseUp = whenFocusedInput.Where(input => input.LeftMouseUp);

            var whenFocusedDrag = from begin in whenLeftMouseDown
                                  let fro = new { YawPitch = camera.YawPitch, Center = camera.Center }
                                  from during in whenFocusedInput.TakeUntil(whenLeftMouseUp)
                                  select new
                                  {
                                      From = fro,
                                      To = during,
                                      Delta = during.MousePosition - begin.MousePosition
                                  };

            var halfOrbitPerPixel = MathHelper.Pi / window.Width * new Vector2(-1, -1);
            var meterPerPixel = 27.0f / window.Width;

            return new CompositeDisposable(

                // Scroll Wheel Camera Distance
                whenFocusedInput.Where(input => input.WheelDelta != 0).Subscribe(input => camera.Distance -= input.WheelDelta),

                // Shift Drag Camera Centroid Translate 
                whenFocusedDrag.Where(d => d.To.KeyPressed(Keys.LeftShift))
                               .Subscribe(drag => camera.Center = drag.From.Center
                                                                + drag.Delta.X * meterPerPixel * camera.World.Left
                                                                + drag.Delta.Y * meterPerPixel * camera.World.Up),

                // Normal Drag Camera Orbit Rotate 
                whenFocusedDrag.Where(d => !d.To.KeyPressed(Keys.LeftShift))
                               .Subscribe(drag => camera.YawPitch = drag.From.YawPitch + drag.Delta * halfOrbitPerPixel));
        }
예제 #10
0
 public WorkFlowTask(Window window)
 {
     Window = window;            
 }
예제 #11
0
 public WorkFlowTask(WorkFlowTask parent)
 {
     Window = parent.Window;
 }
예제 #12
0
 public Trigger(Func<Task> action, IObservable<Input> trigger, Keys keys, Window window)
     : this(action, trigger.Where(input => window.Focused && input.KeyDown(keys))) { }
예제 #13
0
 public Trigger(Func<Task> action, Keys keys, Window window)
     : this(action, Program.WhenInput, keys, window) { }
예제 #14
0
 public CalibrateTask(Window window, Camera camera, Chessboard chessboard)
     : base(window)
 {
     Camera = camera;
     Chessboard = chessboard;
 }
예제 #15
0
 internal static void Register(Window window)
 {
     Debug.Assert(!Windows.Contains(window));
     Windows.Add(window);            
 }