mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Allow opencv8 distortion model in PhotonCamera (#1317)
We previously assumed only OpenCV5 but mrcal uses opencv8
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "photon/PhotonUtils.h"
|
||||
#include "photon/simulation/VisionSystemSim.h"
|
||||
@@ -251,6 +254,7 @@ TEST_P(VisionSystemSimTestWithParamsTest, PitchAngles) {
|
||||
frc::Translation3d{},
|
||||
frc::Rotation3d{0_rad, units::degree_t{GetParam()}, 0_rad}});
|
||||
visionSysSim.Update(robotPose);
|
||||
|
||||
ASSERT_TRUE(camera.GetLatestResult().HasTargets());
|
||||
ASSERT_NEAR(GetParam().to<double>(),
|
||||
camera.GetLatestResult().GetBestTarget().GetPitch(), 0.25);
|
||||
@@ -418,11 +422,8 @@ TEST_F(VisionSystemSimTest, TestPoseEstimation) {
|
||||
{photon::VisionTargetSim{tagList[0].pose, photon::kAprilTag16h5, 0}});
|
||||
visionSysSim.Update(robotPose);
|
||||
|
||||
Eigen::Matrix<double, 3, 3> camEigen;
|
||||
cv::cv2eigen(camera.GetCameraMatrix().value(), camEigen);
|
||||
|
||||
Eigen::Matrix<double, 5, 1> distEigen;
|
||||
cv::cv2eigen(camera.GetDistCoeffs().value(), distEigen);
|
||||
Eigen::Matrix<double, 3, 3> camEigen = camera.GetCameraMatrix().value();
|
||||
Eigen::Matrix<double, 8, 1> distEigen = camera.GetDistCoeffs().value();
|
||||
|
||||
auto camResults = camera.GetLatestResult();
|
||||
auto targetSpan = camResults.GetTargets();
|
||||
|
||||
Reference in New Issue
Block a user