Example #1
0
 public GrayScanTask(Window window, CaptureCamera captureCamera, Projector projector)
     : base(window)
 {
     CaptureCamera = captureCamera;
     Projector = projector;
     Projector.Scene = new Scene(new ScreenCamera(Projector.Window));
 }
 public ChessboardSearchTask(Window window, CaptureCamera captureCamera, Chessboard chessboard)
     : base(window)
 {
     CaptureCamera = captureCamera;
     Chessboard = chessboard;
     WriteLine("Taking Snapshot");
 }
 public ChessboardSearchTask(WorkFlowTask parent, CaptureCamera captureCamera, Chessboard chessboard)
     : base(parent)
 {
     CaptureCamera = captureCamera;
     Chessboard = chessboard;
     WriteLine("Taking Snapshot");
 }
Example #4
0
        public VirtualProjector(string name, string uuid, Size imageSize, PointF principal, double focalLength, Screen screen, Chessboard chessboard, CaptureCamera captureCamera)
            : base(name, uuid, imageSize, principal, focalLength, screen, chessboard, captureCamera)
        {
            OrbitCamera = new OrbitCamera("{0} Orbit".FormatWith(name), "N/A", imageSize, principal, focalLength,
                Intrinsics.NearPlaneDistance, Intrinsics.FarPlaneDistance) { Color = Color.DarkCyan.Alpha(0.7f), };
            Color = Color.DarkKhaki.Alpha(0.6f);
            
            ProgramTask.AttachInputToCamera(Program.WhenInput.Where(input => !input.KeyPressed(Keys.C)), Window, OrbitCamera);

            Program.WhenInput.Where(input => input.KeyDown(Keys.P)).Subscribe(input =>
            {
                var frustum = new Frustum(OrbitCamera, Intrinsics.ImageSize);

                var plane = new Plane(Vector3.UnitZ, 0);

                var p0 = frustum.IntersectWithPlane(ProjectorQuadCorners[0].X, ProjectorQuadCorners[0].Y, plane).ToPointF();
                var p1 = frustum.IntersectWithPlane(ProjectorQuadCorners[1].X, ProjectorQuadCorners[1].Y, plane).ToPointF();
                var p2 = frustum.IntersectWithPlane(ProjectorQuadCorners[2].X, ProjectorQuadCorners[2].Y, plane).ToPointF();
                var p3 = frustum.IntersectWithPlane(ProjectorQuadCorners[3].X, ProjectorQuadCorners[3].Y, plane).ToPointF();

                var quadCorners = new[] { p0, p1, p2, p3, };

                // Chessboard.HomographTo(quadCorners);
            });
        }
Example #5
0
        private void AddVirtualCaptureCamera(string name, string uuid, Color color)
        {
            var size = new Size(1600, 1200);
            var principal = new PointF(392.713f * 2, 274.4965f * 2);
            var orbitCamera = new OrbitCamera("{0} Orbit".FormatWith(name), uuid, size, principal, size.Width, nearPlaneDistance: 2, farPlaneDistance: 40)
            {
                Color = Color.DarkCyan,
                Center = new Vector3(5, 4, 0),
                Distance = 30,
                YawPitch = new Vector2(0.1f, 0.1f),
            };
            var virtualCapture = new VirtualCapture(name, uuid, size, fps: 10)
            {
                Scene = new Scene(orbitCamera)
                { 
                    new Clear(Color.White),
                    Chessboard
                }
            };

            var virtualCaptureCamera = new CaptureCamera(virtualCapture, 0) { Color = color };

            WorldScene.Add(orbitCamera);
            CaptureCameras.Add(virtualCaptureCamera);
        }
Example #6
0
 public Task Run(CaptureCamera captureCamera)
 {
     return Run(() => GetPoints(captureCamera));
 }
Example #7
0
        private async Task<ImageAndWorldPoints> GetPoints(CaptureCamera captureCamera)
        {
            var imagePoints = await new ChessboardSearchTask(this, captureCamera, Chessboard).Run();
            if (imagePoints != null)
            {
                return new ImageAndWorldPoints()
                {
                    WorldPoints = Chessboard.Saddles,
                    ImagePoints = imagePoints,
                };
            }
            else WriteLine("Could Not Find Chessboard");

            return null;

        }