diff --git a/photon-lib/py/photonlibpy/estimation/openCVHelp.py b/photon-lib/py/photonlibpy/estimation/openCVHelp.py index a3b8185ba5..8a6f4911f5 100644 --- a/photon-lib/py/photonlibpy/estimation/openCVHelp.py +++ b/photon-lib/py/photonlibpy/estimation/openCVHelp.py @@ -1,5 +1,5 @@ import math -from typing import Any, Tuple +from typing import Any import cv2 as cv import numpy as np @@ -126,8 +126,8 @@ def solvePNP_Square( objectMat = np.array(OpenCVHelp.translationToTVec(modelTrls)) alt: Transform3d | None = None - reprojectionError : cv.typing.MatLike | None = None - best : Transform3d = Transform3d() + reprojectionError: cv.typing.MatLike | None = None + best: Transform3d = Transform3d() alt: Transform3d | None = None for tries in range(2): @@ -149,7 +149,9 @@ def solvePNP_Square( OpenCVHelp.rVecToRotation(rvecs[1]), ) - if reprojectionError is not None and not math.isnan(reprojectionError[0, 0]): + if reprojectionError is not None and not math.isnan( + reprojectionError[0, 0] + ): break else: pt = imagePoints[0] @@ -160,7 +162,7 @@ def solvePNP_Square( if reprojectionError is None or math.isnan(reprojectionError[0, 0]): print("SolvePNP_Square failed!") return None - + if alt: return PnpResult( best=best, diff --git a/photon-lib/py/photonlibpy/simulation/photonCameraSim.py b/photon-lib/py/photonlibpy/simulation/photonCameraSim.py index 391f4aa19c..fb2fd7d74f 100644 --- a/photon-lib/py/photonlibpy/simulation/photonCameraSim.py +++ b/photon-lib/py/photonlibpy/simulation/photonCameraSim.py @@ -216,9 +216,7 @@ def distance(target: VisionTargetSim): targets.sort(key=distance, reverse=True) - visibleTgts: list[ - typing.Tuple[VisionTargetSim, np.ndarray] - ] = [] + visibleTgts: list[typing.Tuple[VisionTargetSim, np.ndarray]] = [] detectableTgts: list[PhotonTrackedTarget] = [] camRt = RotTrlTransform3d.makeRelativeTo(cameraPose) @@ -271,7 +269,7 @@ def distance(target: VisionTargetSim): if i != t and i != l and i != b: r = i rect = cv.RotatedRect( - (center[0,0], center[0,1]), + (center[0, 0], center[0, 1]), ( imagePoints[r, 0, 0] - lc[0, 0], imagePoints[b, 0, 1] - imagePoints[t, 0, 1], diff --git a/photon-lib/py/photonlibpy/simulation/simCameraProperties.py b/photon-lib/py/photonlibpy/simulation/simCameraProperties.py index 749d03b0b3..3ae234b524 100644 --- a/photon-lib/py/photonlibpy/simulation/simCameraProperties.py +++ b/photon-lib/py/photonlibpy/simulation/simCameraProperties.py @@ -172,9 +172,7 @@ def getLatencyStdDev(self) -> seconds: return self.latencyStdDev def getContourAreaPercent(self, points: np.ndarray) -> float: - return ( - cv.contourArea(cv.convexHull(points)) / self.getResArea() * 100.0 - ) + return cv.contourArea(cv.convexHull(points)) / self.getResArea() * 100.0 def getPixelYaw(self, pixelX: float) -> Rotation2d: fx = self.camIntrinsics[0, 0]