コード例 #1
0
            /// <summary>
            /// <see cref="ArucoObjectTracker.EstimateTranforms(int, Dictionary, HashSet{ArucoObject})"/>
            /// </summary>
            public override void EstimateTranforms(int cameraId, Aruco.Dictionary dictionary)
            {
                if (!IsActivated || arucoTracker.MarkerTracker.DetectedMarkers[cameraId][dictionary] <= 0)
                {
                    return;
                }

                CameraParameters cameraParameters = arucoTracker.ArucoCamera.CameraParameters;

                foreach (var arucoCharucoBoard in arucoTracker.GetArucoObjects <ArucoCharucoBoard>(dictionary))
                {
                    Cv.Core.Vec3d rvec, tvec;
                    arucoCharucoBoard.ValidTransform = Aruco.EstimatePoseCharucoBoard(arucoCharucoBoard.DetectedCorners, arucoCharucoBoard.DetectedIds,
                                                                                      (Aruco.CharucoBoard)arucoCharucoBoard.Board, cameraParameters.CamerasMatrix[cameraId], cameraParameters.DistCoeffs[cameraId], out rvec, out tvec);

                    arucoCharucoBoard.Rvec = rvec;
                    arucoCharucoBoard.Tvec = tvec;
                }
            }
コード例 #2
0
            public override void EstimateTransforms(int cameraId, Aruco.Dictionary dictionary)
            {
                foreach (var arucoCharucoBoard in arucoTracker.GetArucoObjects <ArucoCharucoBoard>(dictionary))
                {
                    Cv.Vec3d rvec = null, tvec = null;
                    bool     validTransform = false;

                    if (arucoTracker.MarkerTracker.DetectedMarkers[cameraId][dictionary] > 0 && cameraParameters != null)
                    {
                        validTransform = Aruco.EstimatePoseCharucoBoard(arucoCharucoBoard.DetectedCorners, arucoCharucoBoard.DetectedIds,
                                                                        (Aruco.CharucoBoard)arucoCharucoBoard.Board, cameraParameters.CameraMatrices[cameraId], cameraParameters.DistCoeffs[cameraId], out rvec,
                                                                        out tvec);
                    }

                    arucoCharucoBoard.Rvec           = rvec;
                    arucoCharucoBoard.Tvec           = tvec;
                    arucoCharucoBoard.ValidTransform = validTransform;
                }
            }