Package org.photonvision.vision.target
Class TargetCalculations
java.lang.Object
org.photonvision.vision.target.TargetCalculations
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.opencv.core.Point
calculateDualOffsetCrosshair
(DualOffsetValues dualOffsetValues, double currentArea) static org.opencv.core.Point
calculateRobotOffsetPoint
(org.opencv.core.Point offsetPoint, org.opencv.core.Point camCenterPoint, DualOffsetValues dualOffsetValues, RobotOffsetPointMode offsetMode) static double
calculateSkew
(boolean isLandscape, org.opencv.core.RotatedRect minAreaRect) static org.opencv.core.Point
calculateTargetOffsetPoint
(boolean isLandscape, TargetOffsetPointEdge offsetRegion, org.opencv.core.RotatedRect minAreaRect) static DoubleCouple
calculateYawPitch
(double offsetCenterX, double targetCenterX, double horizontalFocalLength, double offsetCenterY, double targetCenterY, double verticalFocalLength, CameraCalibrationCoefficients cameraCal) Calculates the yaw and pitch of a point in the image.static double
getAspectRatio
(org.opencv.core.RotatedRect rect, boolean isLandscape) static DoubleCouple
getLineFromPoints
(org.opencv.core.Point firstPoint, org.opencv.core.Point secondPoint)
-
Constructor Details
-
TargetCalculations
public TargetCalculations()
-
-
Method Details
-
calculateYawPitch
public static DoubleCouple calculateYawPitch(double offsetCenterX, double targetCenterX, double horizontalFocalLength, double offsetCenterY, double targetCenterY, double verticalFocalLength, CameraCalibrationCoefficients cameraCal) Calculates the yaw and pitch of a point in the image. Yaw and pitch must be calculated together to account for perspective distortion. Yaw is positive right, and pitch is positive up.- Parameters:
offsetCenterX
- The X value of the offset principal point (cx) in pixelstargetCenterX
- The X value of the target's center point in pixelshorizontalFocalLength
- The horizontal focal length (fx) in pixelsoffsetCenterY
- The Y value of the offset principal point (cy) in pixelstargetCenterY
- The Y value of the target's center point in pixelsverticalFocalLength
- The vertical focal length (fy) in pixelscameraCal
- Camera calibration parameters, or null if not calibrated- Returns:
- The yaw and pitch from the principal axis to the target center, in degrees.
-
calculateSkew
public static double calculateSkew(boolean isLandscape, org.opencv.core.RotatedRect minAreaRect) -
calculateTargetOffsetPoint
public static org.opencv.core.Point calculateTargetOffsetPoint(boolean isLandscape, TargetOffsetPointEdge offsetRegion, org.opencv.core.RotatedRect minAreaRect) -
calculateRobotOffsetPoint
public static org.opencv.core.Point calculateRobotOffsetPoint(org.opencv.core.Point offsetPoint, org.opencv.core.Point camCenterPoint, DualOffsetValues dualOffsetValues, RobotOffsetPointMode offsetMode) -
getAspectRatio
public static double getAspectRatio(org.opencv.core.RotatedRect rect, boolean isLandscape) -
calculateDualOffsetCrosshair
public static org.opencv.core.Point calculateDualOffsetCrosshair(DualOffsetValues dualOffsetValues, double currentArea) -
getLineFromPoints
public static DoubleCouple getLineFromPoints(org.opencv.core.Point firstPoint, org.opencv.core.Point secondPoint)
-