Loading src/UsgsAstroFrameSensorModel.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -225,7 +225,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i double sample = imagePt.samp; double line = imagePt.line; std::cout << "in i->g (s, l): " << sample << ", " << line << std::endl; //Here is where we should be able to apply an adjustment to opk double m[3][3]; calcRotationMatrix(m); Loading @@ -245,7 +244,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i // Apply the distortion model (remove distortion) double undistorted_cameraX, undistorted_cameraY = 0.0; std::cout << "x_camera, y_camera: " << x_camera << ", " << y_camera << std::endl; setFocalPlane(x_camera, y_camera, undistorted_cameraX, undistorted_cameraY); //Now back from distorted mm to pixels Loading @@ -253,9 +251,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i udx = undistorted_cameraX; udy = undistorted_cameraY; std::cout << "udx, udy: " << udx << ", " << udy << std::endl; std::cout << "focal length: " << m_focalLength << std::endl; xl = m[0][0] * udx + m[0][1] * udy - m[0][2] * -m_focalLength; yl = m[1][0] * udx + m[1][1] * udy - m[1][2] * -m_focalLength; zl = m[2][0] * udx + m[2][1] * udy - m[2][2] * -m_focalLength; Loading @@ -268,7 +263,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i // Intersect with some height about the ellipsoid. std::cout << "height, xc, yc, zc, x1, y1, z1 " << height << ", "<< xc << ", " << yc << ", " << zc << ", " << xl << ", " << yl << ", " << zl << std::endl; losEllipsoidIntersect(height, xc, yc, zc, xl, yl, zl, x, y, z); return csm::EcefCoord(x, y, z); Loading Loading @@ -932,8 +926,6 @@ void UsgsAstroFrameSensorModel::calcRotationMatrix( double y = m_currentParameterValue[5]; double z = m_currentParameterValue[6]; std::cout << "w, x, y, z: " << w << ", " << x << ", " << y << ", " << z << std::endl; m[0][0] = w*w + x*x - y*y - z*z; m[0][1] = 2 * (x*y - w*z); m[0][2] = 2 * (w*y + x*z); Loading @@ -943,10 +935,6 @@ void UsgsAstroFrameSensorModel::calcRotationMatrix( m[2][0] = 2 * (x*z - w*y); m[2][1] = 2 * (w*x + y*z); m[2][2] = w*w - x*x - y*y + z*z; std::cout << "[ " << m[0][0] << " " << m[0][1] << " " << m[0][2] << "]" << std::endl; std::cout << "[ " << m[1][0] << " " << m[1][1] << " " << m[1][2] << "]" << std::endl; std::cout << "[ " << m[2][0] << " " << m[2][1] << " " << m[2][2] << "]" << std::endl; } Loading tests/FrameCameraTests.cpp +19 −38 Original line number Diff line number Diff line Loading @@ -90,8 +90,6 @@ TEST_F(FrameSensorModel, setFocalPlane1) { csm::ImageCoord imagePt(7.5, 7.5); double ux,uy; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); Loading @@ -111,7 +109,6 @@ TEST_F(FrameSensorModel, setFocalPlane1) { TEST_F(FrameSensorModel, Jacobian1) { csm::ImageCoord imagePt(7.5, 7.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0}; Loading @@ -136,7 +133,6 @@ TEST_F(FrameSensorModel, Jacobian1) { TEST_F(FrameSensorModel, distortMe_AllCoefficientsOne) { csm::ImageCoord imagePt(7.5, 7.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}; Loading @@ -157,7 +153,6 @@ TEST_F(FrameSensorModel, distortMe_AllCoefficientsOne) { TEST_F(FrameSensorModel, setFocalPlane_AllCoefficientsOne) { csm::ImageCoord imagePt(1872.25, 1872.25); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}; Loading @@ -181,7 +176,6 @@ TEST_F(FrameSensorModel, setFocalPlane_AllCoefficientsOne) { TEST_F(FrameSensorModel, distortMe_AlternatingOnes) { csm::ImageCoord imagePt(7.5, 7.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0}; Loading @@ -203,7 +197,6 @@ TEST_F(FrameSensorModel, distortMe_AlternatingOnes) { TEST_F(FrameSensorModel, setFocalPlane_AlternatingOnes) { csm::ImageCoord imagePt(963.75, 908.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0}; Loading @@ -229,7 +222,6 @@ TEST_F(FrameSensorModel, FL500_OffBody4) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -240,10 +232,9 @@ TEST_F(FrameSensorModel, FL500_OffBody4) { sensorModel->setParameterValue(2, 0.0); // Z modelState = sensorModel->getModelState(); EXPECT_STREQ("", modelState.c_str()); ASSERT_NE(sensorModel, nullptr); csm::ImageCoord imagePt(15.5, 15.5); csm::ImageCoord imagePt(15.0, 15.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); EXPECT_NEAR(groundPt.x, 9.77688917, 1e-8); EXPECT_NEAR(groundPt.y, -1.48533467, 1e-8); Loading @@ -258,14 +249,13 @@ TEST_F(FrameSensorModel, FL500_OffBody3) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; sensorModel->replaceModelState(state.dump()); ASSERT_NE(sensorModel, nullptr); csm::ImageCoord imagePt(0.5, 0.5); csm::ImageCoord imagePt(0.0, 0.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); EXPECT_NEAR(groundPt.x, 9.77688917, 1e-8); EXPECT_NEAR(groundPt.y, 1.48533467, 1e-8); Loading @@ -280,7 +270,6 @@ TEST_F(FrameSensorModel, FL500_Center) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -302,7 +291,6 @@ TEST_F(FrameSensorModel, FL500_SlightlyOffCenter) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -322,7 +310,6 @@ TEST_F(FrameSensorModel, FL500_SlightlyOffCenter) { // Observer x position: TEST_F(FrameSensorModel, X10_SlightlyOffCenter) { double newValue = 10.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(0, newValue); // X ASSERT_NE(sensorModel, nullptr); Loading @@ -339,7 +326,6 @@ TEST_F(FrameSensorModel, X10_SlightlyOffCenter) { TEST_F(FrameSensorModel, X1e9_SlightlyOffCenter) { double newValue = 1000000000.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(0, newValue); // X ASSERT_NE(sensorModel, nullptr); Loading @@ -357,7 +343,6 @@ TEST_F(FrameSensorModel, X1e9_SlightlyOffCenter) { // Angle rotations: TEST_F(FrameSensorModel, Rotation_omegaPi_Center) { // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(3, 1.0); sensorModel->setParameterValue(4, 1.0); Loading @@ -381,7 +366,7 @@ TEST_F(FrameSensorModel, Rotation_omegaPi_Center) { TEST_F(FrameSensorModel, Rotation_NPole_Center) { // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(3, 0.0); sensorModel->setParameterValue(4, -1.0); sensorModel->setParameterValue(5, 0.0); Loading @@ -404,7 +389,6 @@ TEST_F(FrameSensorModel, Rotation_NPole_Center) { TEST_F(FrameSensorModel, Rotation_SPole_Center) { // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(4, 0.0); // phi sensorModel->setParameterValue(0, 0.0); // X sensorModel->setParameterValue(1, 0.0); // Y Loading @@ -427,7 +411,6 @@ TEST_F(FrameSensorModel, SemiMajorAxis100x_Center) { std::string key = "m_majorAxis"; double newValue = 1000.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -449,7 +432,6 @@ TEST_F(FrameSensorModel, SemiMajorAxis10x_SlightlyOffCenter) { std::string key = "m_majorAxis"; double newValue = 100.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -475,7 +457,6 @@ TEST_F(FrameSensorModel, SemiMinorAxis10x_SlightlyOffCenter) { std::string key = "m_minorAxis"; double newValue = 100.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading Loading
src/UsgsAstroFrameSensorModel.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -225,7 +225,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i double sample = imagePt.samp; double line = imagePt.line; std::cout << "in i->g (s, l): " << sample << ", " << line << std::endl; //Here is where we should be able to apply an adjustment to opk double m[3][3]; calcRotationMatrix(m); Loading @@ -245,7 +244,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i // Apply the distortion model (remove distortion) double undistorted_cameraX, undistorted_cameraY = 0.0; std::cout << "x_camera, y_camera: " << x_camera << ", " << y_camera << std::endl; setFocalPlane(x_camera, y_camera, undistorted_cameraX, undistorted_cameraY); //Now back from distorted mm to pixels Loading @@ -253,9 +251,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i udx = undistorted_cameraX; udy = undistorted_cameraY; std::cout << "udx, udy: " << udx << ", " << udy << std::endl; std::cout << "focal length: " << m_focalLength << std::endl; xl = m[0][0] * udx + m[0][1] * udy - m[0][2] * -m_focalLength; yl = m[1][0] * udx + m[1][1] * udy - m[1][2] * -m_focalLength; zl = m[2][0] * udx + m[2][1] * udy - m[2][2] * -m_focalLength; Loading @@ -268,7 +263,6 @@ csm::EcefCoord UsgsAstroFrameSensorModel::imageToGround(const csm::ImageCoord &i // Intersect with some height about the ellipsoid. std::cout << "height, xc, yc, zc, x1, y1, z1 " << height << ", "<< xc << ", " << yc << ", " << zc << ", " << xl << ", " << yl << ", " << zl << std::endl; losEllipsoidIntersect(height, xc, yc, zc, xl, yl, zl, x, y, z); return csm::EcefCoord(x, y, z); Loading Loading @@ -932,8 +926,6 @@ void UsgsAstroFrameSensorModel::calcRotationMatrix( double y = m_currentParameterValue[5]; double z = m_currentParameterValue[6]; std::cout << "w, x, y, z: " << w << ", " << x << ", " << y << ", " << z << std::endl; m[0][0] = w*w + x*x - y*y - z*z; m[0][1] = 2 * (x*y - w*z); m[0][2] = 2 * (w*y + x*z); Loading @@ -943,10 +935,6 @@ void UsgsAstroFrameSensorModel::calcRotationMatrix( m[2][0] = 2 * (x*z - w*y); m[2][1] = 2 * (w*x + y*z); m[2][2] = w*w - x*x - y*y + z*z; std::cout << "[ " << m[0][0] << " " << m[0][1] << " " << m[0][2] << "]" << std::endl; std::cout << "[ " << m[1][0] << " " << m[1][1] << " " << m[1][2] << "]" << std::endl; std::cout << "[ " << m[2][0] << " " << m[2][1] << " " << m[2][2] << "]" << std::endl; } Loading
tests/FrameCameraTests.cpp +19 −38 Original line number Diff line number Diff line Loading @@ -90,8 +90,6 @@ TEST_F(FrameSensorModel, setFocalPlane1) { csm::ImageCoord imagePt(7.5, 7.5); double ux,uy; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); Loading @@ -111,7 +109,6 @@ TEST_F(FrameSensorModel, setFocalPlane1) { TEST_F(FrameSensorModel, Jacobian1) { csm::ImageCoord imagePt(7.5, 7.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0}; Loading @@ -136,7 +133,6 @@ TEST_F(FrameSensorModel, Jacobian1) { TEST_F(FrameSensorModel, distortMe_AllCoefficientsOne) { csm::ImageCoord imagePt(7.5, 7.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}; Loading @@ -157,7 +153,6 @@ TEST_F(FrameSensorModel, distortMe_AllCoefficientsOne) { TEST_F(FrameSensorModel, setFocalPlane_AllCoefficientsOne) { csm::ImageCoord imagePt(1872.25, 1872.25); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0}; Loading @@ -181,7 +176,6 @@ TEST_F(FrameSensorModel, setFocalPlane_AllCoefficientsOne) { TEST_F(FrameSensorModel, distortMe_AlternatingOnes) { csm::ImageCoord imagePt(7.5, 7.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0}; Loading @@ -203,7 +197,6 @@ TEST_F(FrameSensorModel, distortMe_AlternatingOnes) { TEST_F(FrameSensorModel, setFocalPlane_AlternatingOnes) { csm::ImageCoord imagePt(963.75, 908.5); // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state["m_odtX"] = {1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0}; Loading @@ -229,7 +222,6 @@ TEST_F(FrameSensorModel, FL500_OffBody4) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -240,10 +232,9 @@ TEST_F(FrameSensorModel, FL500_OffBody4) { sensorModel->setParameterValue(2, 0.0); // Z modelState = sensorModel->getModelState(); EXPECT_STREQ("", modelState.c_str()); ASSERT_NE(sensorModel, nullptr); csm::ImageCoord imagePt(15.5, 15.5); csm::ImageCoord imagePt(15.0, 15.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); EXPECT_NEAR(groundPt.x, 9.77688917, 1e-8); EXPECT_NEAR(groundPt.y, -1.48533467, 1e-8); Loading @@ -258,14 +249,13 @@ TEST_F(FrameSensorModel, FL500_OffBody3) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; sensorModel->replaceModelState(state.dump()); ASSERT_NE(sensorModel, nullptr); csm::ImageCoord imagePt(0.5, 0.5); csm::ImageCoord imagePt(0.0, 0.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); EXPECT_NEAR(groundPt.x, 9.77688917, 1e-8); EXPECT_NEAR(groundPt.y, 1.48533467, 1e-8); Loading @@ -280,7 +270,6 @@ TEST_F(FrameSensorModel, FL500_Center) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -302,7 +291,6 @@ TEST_F(FrameSensorModel, FL500_SlightlyOffCenter) { std::string key = "m_focalLength"; double newValue = 500.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -322,7 +310,6 @@ TEST_F(FrameSensorModel, FL500_SlightlyOffCenter) { // Observer x position: TEST_F(FrameSensorModel, X10_SlightlyOffCenter) { double newValue = 10.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(0, newValue); // X ASSERT_NE(sensorModel, nullptr); Loading @@ -339,7 +326,6 @@ TEST_F(FrameSensorModel, X10_SlightlyOffCenter) { TEST_F(FrameSensorModel, X1e9_SlightlyOffCenter) { double newValue = 1000000000.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(0, newValue); // X ASSERT_NE(sensorModel, nullptr); Loading @@ -357,7 +343,6 @@ TEST_F(FrameSensorModel, X1e9_SlightlyOffCenter) { // Angle rotations: TEST_F(FrameSensorModel, Rotation_omegaPi_Center) { // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(3, 1.0); sensorModel->setParameterValue(4, 1.0); Loading @@ -381,7 +366,7 @@ TEST_F(FrameSensorModel, Rotation_omegaPi_Center) { TEST_F(FrameSensorModel, Rotation_NPole_Center) { // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(3, 0.0); sensorModel->setParameterValue(4, -1.0); sensorModel->setParameterValue(5, 0.0); Loading @@ -404,7 +389,6 @@ TEST_F(FrameSensorModel, Rotation_NPole_Center) { TEST_F(FrameSensorModel, Rotation_SPole_Center) { // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); sensorModel->setParameterValue(4, 0.0); // phi sensorModel->setParameterValue(0, 0.0); // X sensorModel->setParameterValue(1, 0.0); // Y Loading @@ -427,7 +411,6 @@ TEST_F(FrameSensorModel, SemiMajorAxis100x_Center) { std::string key = "m_majorAxis"; double newValue = 1000.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -449,7 +432,6 @@ TEST_F(FrameSensorModel, SemiMajorAxis10x_SlightlyOffCenter) { std::string key = "m_majorAxis"; double newValue = 100.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading @@ -475,7 +457,6 @@ TEST_F(FrameSensorModel, SemiMinorAxis10x_SlightlyOffCenter) { std::string key = "m_minorAxis"; double newValue = 100.0; // UsgsAstroFrameSensorModel* sensorModel = createModel(isd); std::string modelState = sensorModel->getModelState(); auto state = json::parse(modelState); state[key] = newValue; Loading