Skip to content

Commit

Permalink
Added adjustable focal length back (#258)
Browse files Browse the repository at this point in the history
* Added adjustable focal length back

* Added adjustable focal length test

* Better test
  • Loading branch information
jessemapel authored Jan 15, 2020
1 parent 2c0738a commit b2ea3a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/UsgsAstroLsSensorModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,8 @@ void UsgsAstroLsSensorModel::losToEcf(

// Define imaging ray (look vector) in camera space
double cameraLook[3];
createCameraLookVector(undistortedFocalPlaneX, undistortedFocalPlaneY, m_zDirection, m_focalLength, cameraLook);
createCameraLookVector(undistortedFocalPlaneX, undistortedFocalPlaneY,
m_zDirection, m_focalLength + getValue(15, adj), cameraLook);
MESSAGE_LOG(m_logger, "losToEcf: uncorrected camera look vector {} {} {}",
cameraLook[0], cameraLook[1], cameraLook[2])

Expand Down Expand Up @@ -2501,7 +2502,7 @@ csm::ImageCoord UsgsAstroLsSensorModel::computeViewingPixel(
adjustedLookX, adjustedLookY, adjustedLookZ)

// Convert to focal plane coordinate
double lookScale = m_focalLength / adjustedLookZ;
double lookScale = (m_focalLength + getValue(15, adj)) / adjustedLookZ;
double focalX = adjustedLookX * lookScale;
double focalY = adjustedLookY * lookScale;
double distortedFocalX, distortedFocalY;
Expand Down
9 changes: 9 additions & 0 deletions tests/LineScanCameraTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,12 @@ TEST_F(OrbitalLineScanSensorModel, ReferenceDateTime) {
std::string date = sensorModel->getReferenceDateAndTime();
EXPECT_EQ(date, "20000101T001639");
}

TEST_F(ConstVelocityLineScanSensorModel, FocalLengthAdjustment) {
csm::ImageCoord imagePt(8.5, 4.0);
sensorModel->setParameterValue(15, -45);
csm::EcefLocus locus = sensorModel->imageToRemoteImagingLocus(imagePt);
EXPECT_DOUBLE_EQ(locus.direction.x, -5.0 / sqrt(5 * 5 + 0.4 * 0.4));
EXPECT_DOUBLE_EQ(locus.direction.y, -0.4 / sqrt(5 * 5 + 0.4 * 0.4));
EXPECT_DOUBLE_EQ(locus.direction.z, 0.0);
}

0 comments on commit b2ea3a2

Please sign in to comment.