diff --git a/NEWS.rst b/NEWS.rst index 6633c7355..2beb00dd3 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -15,7 +15,8 @@ jitter_solve (:numref:`jitter_solve`): * Add an example for the Kaguya Terrain Camera (:numref:`jitter_kaguya`). * Can use GCP files. * Can read a control network from an nvm file. - + * Do two passes. This improves the results. + stereo_gui (:numref:`stereo_gui`): * Changing the image threshold updates the display correctly. * When creating GCP, ask before quitting without saving them. Save the IP as diff --git a/docs/tools/jitter_solve.rst b/docs/tools/jitter_solve.rst index a5c07c2ef..f42d1ed54 100644 --- a/docs/tools/jitter_solve.rst +++ b/docs/tools/jitter_solve.rst @@ -2121,6 +2121,11 @@ Command-line options for jitter_solve ahead of the camera, in units of meters. Some of these may be later filtered as outliers. +--num-passes + How many passes of jitter solving to do, with the given number of iterations + in each pass. Each pass uses the previously refined cameras, which improves + the accuracy of the DEM constraint and the final result. + --rig-config Assume that the cameras are acquired with a set of rigs with this configuration file (:numref:`jitter_rig`). The intrinsics will be read, but diff --git a/src/asp/Camera/BundleAdjustResiduals.cc b/src/asp/Camera/BundleAdjustResiduals.cc index 4181390f8..93b200f50 100644 --- a/src/asp/Camera/BundleAdjustResiduals.cc +++ b/src/asp/Camera/BundleAdjustResiduals.cc @@ -467,7 +467,7 @@ void saveTriOffsetsPerCamera(std::vector const& image_files, // Sanity check if (ipt < 0 || ipt >= num_points) - vw_throw(LogicErr() << "Invalid point index " << ipt + vw::vw_throw(vw::LogicErr() << "Invalid point index " << ipt << " in saveTriOffsetsPerCamera().\n"); if (outliers.find(ipt) != outliers.end()) diff --git a/src/asp/Tools/jitter_solve.cc b/src/asp/Tools/jitter_solve.cc index 86f56d173..1929938f6 100644 --- a/src/asp/Tools/jitter_solve.cc +++ b/src/asp/Tools/jitter_solve.cc @@ -248,7 +248,7 @@ void handle_arguments(int argc, char *argv[], Options& opt, rig::RigSet & rig) { ("num-passes", po::value(&opt.num_passes)->default_value(2), "How many passes of jitter solving to do, with given number of iterations in each " - "pass. For more than one pass.") + "pass.") ("rig-config", po::value(&opt.rig_config)->default_value(""), "Assume that the cameras are acquired with a set of rigs with this configuration " "file. The intrinsics will be read, but not the transforms between sensors, as those " @@ -870,7 +870,7 @@ void jitterSolvePass(int pass, rig::RigSet & rig, std::vector & ref_to_curr_sensor_vec) { - vw::vw_out() << "Jitter solving pass: " << pass << "\n"; + vw::vw_out() << "\nJitter solving pass: " << pass << "\n"; // If some of the input cameras are frame, need to store position and // quaternion variables for them outside the camera model. @@ -1095,6 +1095,15 @@ void jitterSolvePass(int pass, orig_cam_positions, opt_cam_positions, cam_offsets_file); + // Resize the tri_points_vec to eliminate the anchor points that were appended. + // The number of those can be variable in each pass and those do not contribute + // to the triangulation offsets. This must be at the end. + int num_tri_points = cnet.size(); + size_t tri_len = num_tri_points*NUM_XYZ_PARAMS; + if (orig_tri_points_vec.size() < tri_len || tri_points_vec.size() < tri_len) + vw_throw(ArgumentErr() << "Expecting more triangulated points.\n"); + orig_tri_points_vec.resize(tri_len); + tri_points_vec.resize(tri_len); std::string tri_offsets_file = opt.out_prefix + "-triangulation_offsets.txt"; asp::saveTriOffsetsPerCamera(opt.image_files, outliers, orig_tri_points_vec, tri_points_vec,