Correct yet more python type hinting (#1555)

This commit is contained in:
James Ward
2024-11-13 03:17:27 +11:00
committed by GitHub
parent af03ae0a8b
commit 744e522aea
7 changed files with 38 additions and 40 deletions

View File

@@ -171,10 +171,8 @@ class SimCameraProperties:
def getLatencyStdDev(self) -> seconds:
return self.latencyStdDev
def getContourAreaPercent(self, points: list[typing.Tuple[float, float]]) -> float:
return (
cv.contourArea(cv.convexHull(np.array(points))) / self.getResArea() * 100.0
)
def getContourAreaPercent(self, points: np.ndarray) -> float:
return cv.contourArea(cv.convexHull(points)) / self.getResArea() * 100.0
def getPixelYaw(self, pixelX: float) -> Rotation2d:
fx = self.camIntrinsics[0, 0]
@@ -188,14 +186,14 @@ class SimCameraProperties:
yOffset = cy - pixelY
return Rotation2d(fy, -yOffset)
def getPixelRot(self, point: typing.Tuple[int, int]) -> Rotation3d:
def getPixelRot(self, point: cv.typing.Point2f) -> Rotation3d:
return Rotation3d(
0.0,
self.getPixelPitch(point[1]).radians(),
self.getPixelYaw(point[0]).radians(),
)
def getCorrectedPixelRot(self, point: typing.Tuple[float, float]) -> Rotation3d:
def getCorrectedPixelRot(self, point: cv.typing.Point2f) -> Rotation3d:
fx = self.camIntrinsics[0, 0]
cx = self.camIntrinsics[0, 2]
xOffset = cx - point[0]