Allow opencv8 distortion model in PhotonCamera (#1317)

We previously assumed only OpenCV5 but mrcal uses opencv8
This commit is contained in:
Matt
2024-05-29 17:28:35 -04:00
committed by GitHub
parent fcca858a37
commit 19b4802094
17 changed files with 172 additions and 94 deletions

View File

@@ -122,7 +122,7 @@ static std::vector<cv::Point3f> RotationToRVec(
static std::vector<cv::Point2f> ProjectPoints(
const Eigen::Matrix<double, 3, 3>& cameraMatrix,
const Eigen::Matrix<double, 5, 1>& distCoeffs,
const Eigen::Matrix<double, 8, 1>& distCoeffs,
const RotTrlTransform3d& camRt,
const std::vector<frc::Translation3d>& objectTranslations) {
std::vector<cv::Point3f> objectPoints = TranslationToTVec(objectTranslations);
@@ -184,7 +184,7 @@ static frc::Rotation3d RVecToRotation(const cv::Mat& rvecInput) {
[[maybe_unused]] static photon::PNPResult SolvePNP_Square(
const Eigen::Matrix<double, 3, 3>& cameraMatrix,
const Eigen::Matrix<double, 5, 1>& distCoeffs,
const Eigen::Matrix<double, 8, 1>& distCoeffs,
std::vector<frc::Translation3d> modelTrls,
std::vector<cv::Point2f> imagePoints) {
modelTrls = ReorderCircular(modelTrls, true, -1);
@@ -252,7 +252,7 @@ static frc::Rotation3d RVecToRotation(const cv::Mat& rvecInput) {
[[maybe_unused]] static photon::PNPResult SolvePNP_SQPNP(
const Eigen::Matrix<double, 3, 3>& cameraMatrix,
const Eigen::Matrix<double, 5, 1>& distCoeffs,
const Eigen::Matrix<double, 8, 1>& distCoeffs,
std::vector<frc::Translation3d> modelTrls,
std::vector<cv::Point2f> imagePoints) {
std::vector<cv::Point3f> objectMat = TranslationToTVec(modelTrls);

View File

@@ -48,7 +48,7 @@ static std::vector<frc::AprilTag> GetVisibleLayoutTags(
static PNPResult EstimateCamPosePNP(
const Eigen::Matrix<double, 3, 3>& cameraMatrix,
const Eigen::Matrix<double, 5, 1>& distCoeffs,
const Eigen::Matrix<double, 8, 1>& distCoeffs,
const std::vector<PhotonTrackedTarget>& visTags,
const frc::AprilTagFieldLayout& layout, const TargetModel& tagModel) {
if (visTags.size() == 0) {