public static void Run(string[] args)
        {
            var xefPath = @"C:\XEF\cam2_cal.xef";
            var xef     = new Xef(xefPath);
            //Load computer vision (CV) color file
            var colorCV = xef.LoadCvColorFrame(0);

            colorCV.DrawAruco().ShowNoWait();
            var cameraSpace = xef.LoadCVCameraSpace(2);

            var(tx, markers) = Calibrator.Calibrate(colorCV, cameraSpace);
            var pose = tx
                       .CameraSpaceToWorldTx
                       .ToMat();

            var camSpaceTx = cameraSpace.Transform(pose)
                             .ToCamSpacePoints();

            //Save as XYZRGB file (open in MeshLab to view)
            XYZRGB.Export(camSpaceTx, colorCV.GetBRGABytes(), @"C:\XEF\cam2_cal.txt");
            markers = markers.OrderByDescending(m => m.MaskSum.Val0).Take(4).ToList();
            var markerPoints = new CvCameraSpace();

            markers.ForEach(m => markerPoints.Add(m.KxCenter));
            var txMarkers = markerPoints.Transform(pose);

            XYZRGB.Export(txMarkers, new Scalar(255, 0, 0), @"C:\XEF\cam2_cal_markers.txt");
        }
예제 #2
0
        public static void Run()
        {
            var xefPath = @"C:\XEF\cam1_cal.xef";
            var xef     = new Xef(xefPath);
            //Load computer vision (CV) color file
            var colorCV     = xef.LoadCvColorFrame(0);
            var cameraSpace = xef.LoadCVCameraSpace(0);
            var pose        = Calibrator.Calibrate(colorCV, cameraSpace)
                              .Transform
                              .CameraSpaceToWorldTx
                              .ToMat();

            cameraSpace.Transform(pose);
            //Save as XYZRGB file (open in MeshLab to view)
            XYZRGB.Export(cameraSpace.ToCamSpacePoints(), colorCV.GetBRGABytes(), @"C:\XEF\cam1_cal.txt");
        }