Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Feb 5, 2024
1 parent 9654cf4 commit 2e0bca3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/mrcal_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,27 @@ int homography_test() {
std::printf("\n");
}

return true;
double fx = 100, fy = 100, cx = 50, cy = 20;
cv::Mat1d camMat = (Mat_<double>(3,3) << fx, 0, cx, 0, fy, cy, 0, 0, 1);
cv::Mat1d distCoeffs = (Mat_<double>(1,5) << 0.17802570252202954,-1.461379065131586,0.001019661566461145,0.0003215220840230439,2.7249642067580533);

undistort_mrcal(&inputs, &outputs, &camMat, &distCoeffs, CameraLensModel::LENSMODEL_OPENCV5, 0, 0, 0, 0);

cv::Mat2d outputs_opencv = cv::Mat2d::zeros(inputs.size());
cv::undistortImagePoints(inputs, outputs_opencv, camMat, distCoeffs,
TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 50,
1e-4));

std::cout << "cam mat\n" << camMat << std::endl;
std::cout << "dist\n" << distCoeffs << std::endl;
std::cout << "Inputs\n" << inputs << std::endl;
std::cout << "Outputs (mrcal)\n" << outputs << std::endl;
std::cout << "Outputs (opencv)\n" << outputs_opencv << std::endl;
}

int main() {
// for (int i = 0; i < 1e6; i++) {
homography_test();
homography_test();
// }

}

0 comments on commit 2e0bca3

Please sign in to comment.