Permalink
Browse files

DG: Fix bug with TLC having a non zero beginning

A prior commit to fix a single entry TLC was a little too sloppy on my
part. At least we have a new self check inside the camera model to
help identify future problems that I was able to foresee.
  • Loading branch information...
1 parent b672717 commit b5d94a773fa854d64e45bfdb5192a0f2700cf5a4 Zack Moratto committed Aug 21, 2012
@@ -209,9 +209,17 @@ namespace asp {
"forward" ) {
direction = -1;
}
- img.tlc_vec.push_back( std::make_pair(img.avg_line_rate, direction) );
+ img.tlc_vec.push_back( std::make_pair(img.tlc_vec.front().first +
+ img.avg_line_rate, direction) );
}
+ // Build the TLCTimeInterpolation object and do a quick sanity check.
+ camera::TLCTimeInterpolation tlc_time_interpolation( img.tlc_vec,
+ convert( pt::time_from_string( img.tlc_start_time ) ) );
+ VW_ASSERT( fabs( convert( pt::time_from_string( img.first_line_start_time ) ) -
+ tlc_time_interpolation( 0 ) ) < 1e-6,
+ MathErr() << "First Line Time and output from TLC lookup table do not agree of the ephemeris time for the first line of the image." );
+
typedef LinescanDGModel<camera::PiecewiseAPositionInterpolation, camera::SLERPPoseInterpolation, camera::TLCTimeInterpolation> camera_type;
typedef boost::shared_ptr<camera::CameraModel> result_type;
@@ -221,10 +229,9 @@ namespace asp {
camera::SLERPPoseInterpolation( att.quat_vec,
convert( pt::time_from_string( att.start_time ) ),
att.time_interval ),
- camera::TLCTimeInterpolation( img.tlc_vec,
- convert( pt::time_from_string( img.tlc_start_time ) ) ),
- img.image_size, subvector(inverse(sensor_coordinate).rotate(Vector3(geo.detector_origin[0],
- geo.detector_origin[1], 0 ) ), 0, 2 ),
+ tlc_time_interpolation, img.image_size,
+ subvector(inverse(sensor_coordinate).rotate(Vector3(geo.detector_origin[0],
+ geo.detector_origin[1], 0 ) ), 0, 2 ),
geo.principal_distance ) );
}
@@ -134,6 +134,11 @@ TEST(StereoSessionDG, CreateCamera) {
1e-1 /*pixels*/);
}
}
+
+ // Create a camera that only has a single TLC entry. It will throw
+ // an error in the event that first line time and TLC entry lookup
+ // don't agree. That should be good enough for a test.
+ EXPECT_NO_THROW( boost::shared_ptr<camera::CameraModel> cam3( session.camera_model("", "dg_example3.xml") ) );
}
TEST(StereoSessionDG, ReadRPC) {
Oops, something went wrong.

0 comments on commit b5d94a7

Please sign in to comment.