Skip to content
Snippets Groups Projects
Commit 52cc5976 authored by acpaquette's avatar acpaquette Committed by Jesse Mapel
Browse files

Distortion Model Testing (#232)

* debugging

* Added kaguya distortion test

* Mentioned where I got some coefficients for testing

* Removed leftover debugging statements

* Updated kaguya remove coefficients test

* Updated as many EXPECT_NEAR macros to ASSERT_DOUBLE_EQ as possible
parent 76a95abd
No related branches found
No related tags found
No related merge requests found
......@@ -160,8 +160,8 @@ TEST(DawnFc, testApply) {
applyDistortion(imagePt.samp, imagePt.line, dx, dy, coeffs,
DistortionType::DAWNFC, desiredPrecision);
EXPECT_NEAR(dx, 10.0168, 1e-8);
EXPECT_NEAR(dy, 10.0168, 1e-8);
ASSERT_DOUBLE_EQ(dx, 10.0168);
ASSERT_DOUBLE_EQ(dy, 10.0168);
}
TEST(DawnFc, testRemove) {
......@@ -169,6 +169,7 @@ TEST(DawnFc, testRemove) {
double ux, uy;
double desiredPrecision = 0.0000001;
// Coeffs obtained from file FC21A0039691_15231053805F1E.IMG
std::vector<double> coeffs = {8.4e-06};
removeDistortion(imagePt.samp, imagePt.line, ux, uy, coeffs,
......@@ -177,3 +178,79 @@ TEST(DawnFc, testRemove) {
EXPECT_NEAR(ux, 10.0, 1e-8);
EXPECT_NEAR(uy, 10.0, 1e-8);
}
TEST(DawnFc, testZeroCoeffs) {
csm::ImageCoord imagePt(10.0, 10.0);
double ux, uy, dx, dy;
double desiredPrecision = 0.0000001;
std::vector<double> coeffs = {0};
applyDistortion(imagePt.samp, imagePt.line, dx, dy, coeffs,
DistortionType::DAWNFC, desiredPrecision);
removeDistortion(dx, dy, ux, uy, coeffs,
DistortionType::DAWNFC, desiredPrecision);
ASSERT_DOUBLE_EQ(dx, 10.0);
ASSERT_DOUBLE_EQ(dy, 10.0);
ASSERT_DOUBLE_EQ(ux, 10.0);
ASSERT_DOUBLE_EQ(uy, 10.0);
}
TEST(KaguyaTc, testRemoveCoeffs) {
csm::ImageCoord imagePt(1.0, 1.0);
double ux, uy;
double desiredPrecision = 0.0000001;
std::vector<double> distortionCoeffs = {1, 2, 3, 4,
1, 2, 3, 4};
removeDistortion(imagePt.samp, imagePt.line, ux, uy, distortionCoeffs,
DistortionType::KAGUYATC, desiredPrecision);
EXPECT_NEAR(ux, 1 + 1 + 2.828427125 + 6 + 11.313708499, 1e-8);
EXPECT_NEAR(uy, 1 + 1 + 2.828427125 + 6 + 11.313708499, 1e-8);
}
TEST(KaguyaTc, testCoeffs) {
csm::ImageCoord imagePt(1.0, 1.0);
double ux, uy, dx, dy;
double desiredPrecision = 0.0000001;
// Coeffs obtained from file TC1W2B0_01_05211N095E3380.img
std::vector<double> coeffs = {-0.0009649900000000001, 0.00098441, 8.5773e-06, -3.7438e-06,
-0.0013796, 1.3502e-05, 2.7251e-06, -6.193800000000001e-06};
applyDistortion(imagePt.samp, imagePt.line, dx, dy, coeffs,
DistortionType::KAGUYATC, desiredPrecision);
removeDistortion(dx, dy, ux, uy, coeffs,
DistortionType::KAGUYATC, desiredPrecision);
EXPECT_NEAR(dx, 0.999566, 1e-6);
EXPECT_NEAR(dy, 1.00137, 1e-5);
EXPECT_NEAR(ux, 1.0, 1e-8);
EXPECT_NEAR(uy, 1.0, 1e-8);
}
TEST(KaguyaTc, testZeroCoeffs) {
csm::ImageCoord imagePt(1.0, 1.0);
double ux, uy, dx, dy;
double desiredPrecision = 0.0000001;
std::vector<double> coeffs = {0, 0, 0, 0,
0, 0, 0, 0};
applyDistortion(imagePt.samp, imagePt.line, dx, dy, coeffs,
DistortionType::KAGUYATC, desiredPrecision);
removeDistortion(dx, dy, ux, uy, coeffs,
DistortionType::KAGUYATC, desiredPrecision);
ASSERT_DOUBLE_EQ(dx, 1.0);
ASSERT_DOUBLE_EQ(dy, 1.0);
ASSERT_DOUBLE_EQ(ux, 1.0);
ASSERT_DOUBLE_EQ(uy, 1.0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment