Package org.photonvision.estimation
Class VisionEstimation
java.lang.Object
org.photonvision.estimation.VisionEstimation
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionestimateCamPosePNP
(Matrix<N3, N3> cameraMatrix, Matrix<N8, N1> distCoeffs, List<PhotonTrackedTarget> visTags, AprilTagFieldLayout tagLayout, TargetModel tagModel) Performs solvePNP using 3d-2d point correspondences of visible AprilTags to estimate the field-to-camera transformation.getVisibleLayoutTags
(List<PhotonTrackedTarget> visTags, AprilTagFieldLayout tagLayout) Get the visibleAprilTag
s which are in the tag layout using the visible tag IDs.
-
Constructor Details
-
VisionEstimation
public VisionEstimation()
-
-
Method Details
-
getVisibleLayoutTags
public static List<AprilTag> getVisibleLayoutTags(List<PhotonTrackedTarget> visTags, AprilTagFieldLayout tagLayout) Get the visibleAprilTag
s which are in the tag layout using the visible tag IDs. -
estimateCamPosePNP
public static Optional<PnpResult> estimateCamPosePNP(Matrix<N3, N3> cameraMatrix, Matrix<N8, N1> distCoeffs, List<PhotonTrackedTarget> visTags, AprilTagFieldLayout tagLayout, TargetModel tagModel) Performs solvePNP using 3d-2d point correspondences of visible AprilTags to estimate the field-to-camera transformation. If only one tag is visible, the result may have an alternate solution.Note: The returned transformation is from the field origin to the camera pose!
- Parameters:
cameraMatrix
- The camera intrinsics matrix in standard opencv formdistCoeffs
- The camera distortion matrix in standard opencv formvisTags
- The visible tags reported by PV. Non-tag targets are automatically excluded.tagLayout
- The known tag layout on the field- Returns:
- The transformation that maps the field origin to the camera pose. Ensure the
PnpResult
are present before utilizing them.
-