Hi,
thanks for releasing the usefull library. Recently, I have tried to integrate ceres into an existed sfm workflow and added position constrains for each image with help of GPS information, just like the cost function in following topic. however, the difference is that my workflow can be divided into tow steps:
1) relative sfm without GPS information. In this step, the first image' pose is identify and translation is zero. and only reprojection residuals are considered.
2) absolute sfm with GPS information. In this step, the extra residual blocks are added besides the reprojection residual, which estmate the offset between image position and GPS position.
according to these two step, I could successfully do bundle adjustment in step one. But very slow iteration speed has been identified as following and termination status is no convergent!
Then, anyone could provide some tips on how to accelate this iteration.
Thanks! any help is highly appreciated!
San Jiang.
===============================================================================================
https://groups.google.com/forum/#!starred/ceres-solver/-Cq37gjICL0 bool operator()(const T* const qvec, const T* const tvec,
T* residuals) const {
// Calculate pose center.
//const Eigen::Quaternion<T> quat(qvec[0], qvec[1], qvec[2], qvec[3]);
//Eigen::Matrix<T, 3, 1> tran(tvec[0], tvec[1], tvec[2]);
//Eigen::Matrix<T, 3, 1> imgC = quat * -tran;
//residuals[0] = imgC[0] - T(gpsC_(0));
//residuals[1] = imgC[1] - T(gpsC_(1));
//residuals[2] = imgC[2] - T(gpsC_(2));
residuals[0] = tvec[0] - T(gpsC_(0));
residuals[1] = tvec[1] - T(gpsC_(1));
residuals[2] = tvec[2] - T(gpsC_(2));
if (weight_ > 0.0)
{
residuals[0] *= T(weight_);
residuals[1] *= T(weight_);
residuals[2] *= T(weight_);
}
return true;
}
===============================================================================================
==============================================================================
Absolute bundle adjustment
==============================================================================
iter cost cost_change |gradient| |step| tr_ratio tr_radius ls_iter iter_time total_time
0 2.502760e+007 0.00e+000 2.06e+005 0.00e+000 0.00e+000 1.00e+004 0 6.12e-001 4.32e+000
1 2.502713e+007 4.69e+002 2.62e+003 1.60e-002 1.00e+000 3.00e+004 1 2.80e+000 7.12e+000
2 2.502713e+007 3.63e+000 4.20e+002 2.31e-002 1.00e+000 9.00e+004 1 1.42e+000 8.54e+000
3 2.502712e+007 6.49e+000 1.58e+003 6.25e-002 1.00e+000 2.70e+005 1 1.39e+000 9.93e+000
4 2.502711e+007 1.45e+001 3.14e+003 1.85e-001 1.00e+000 8.10e+005 1 1.29e+000 1.12e+001
5 2.502707e+007 4.04e+001 1.50e+004 5.71e-001 9.97e-001 2.43e+006 1 1.44e+000 1.27e+001
6 2.502696e+007 1.12e+002 1.33e+005 1.73e+000 9.20e-001 5.96e+006 1 1.39e+000 1.40e+001
7 2.502696e+007 -4.67e+001 0.00e+000 4.25e+000 -1.52e-001 2.98e+006 1 7.97e-001 1.48e+001
8 2.502682e+007 1.36e+002 2.01e+005 2.13e+000 8.60e-001 4.76e+006 1 1.36e+000 1.62e+001
9 2.502670e+007 1.16e+002 5.12e+005 3.40e+000 4.46e-001 4.76e+006 1 1.40e+000 1.76e+001
10 2.502647e+007 2.38e+002 5.10e+005 3.39e+000 6.26e-001 4.83e+006 1 1.32e+000 1.89e+001
11 2.502623e+007 2.32e+002 5.25e+005 3.45e+000 6.06e-001 4.88e+006 1 1.24e+000 2.02e+001
12 2.502600e+007 2.38e+002 5.33e+005 3.48e+000 6.04e-001 4.92e+006 1 1.25e+000 2.14e+001
13 2.502576e+007 2.40e+002 5.41e+005 3.51e+000 5.99e-001 4.96e+006 1 1.28e+000 2.27e+001
14 2.502551e+007 2.43e+002 5.48e+005 3.54e+000 5.96e-001 5.00e+006 1 1.27e+000 2.40e+001
15 2.502527e+007 2.45e+002 5.54e+005 3.57e+000 5.93e-001 5.03e+006 1 1.28e+000 2.52e+001
16 2.502502e+007 2.47e+002 5.59e+005 3.59e+000 5.90e-001 5.06e+006 1 1.28e+000 2.65e+001
17 2.502477e+007 2.49e+002 5.63e+005 3.61e+000 5.88e-001 5.09e+006 1 1.27e+000 2.78e+001
18 2.502452e+007 2.51e+002 5.67e+005 3.63e+000 5.86e-001 5.12e+006 1 1.31e+000 2.91e+001
19 2.502427e+007 2.52e+002 5.70e+005 3.65e+000 5.85e-001 5.14e+006 1 1.23e+000 3.03e+001
20 2.502401e+007 2.54e+002 5.73e+005 3.67e+000 5.83e-001 5.16e+006 1 1.27e+000 3.16e+001
21 2.502376e+007 2.55e+002 5.76e+005 3.68e+000 5.82e-001 5.19e+006 1 1.28e+000 3.29e+001
22 2.502350e+007 2.56e+002 5.78e+005 3.70e+000 5.82e-001 5.21e+006 1 1.29e+000 3.42e+001
23 2.502324e+007 2.58e+002 5.80e+005 3.72e+000 5.81e-001 5.23e+006 1 1.29e+000 3.55e+001
24 2.502299e+007 2.59e+002 5.81e+005 3.73e+000 5.80e-001 5.25e+006 1 1.27e+000 3.67e+001
25 2.502273e+007 2.60e+002 5.83e+005 3.75e+000 5.80e-001 5.28e+006 1 1.28e+000 3.80e+001
26 2.502246e+007 2.61e+002 5.84e+005 3.76e+000 5.80e-001 5.30e+006 1 1.29e+000 3.93e+001
27 2.502220e+007 2.62e+002 5.85e+005 3.78e+000 5.80e-001 5.32e+006 1 1.28e+000 4.06e+001
28 2.502194e+007 2.63e+002 5.85e+005 3.79e+000 5.80e-001 5.34e+006 1 1.25e+000 4.18e+001
29 2.502167e+007 2.65e+002 5.86e+005 3.81e+000 5.80e-001 5.36e+006 1 1.28e+000 4.31e+001
30 2.502141e+007 2.66e+002 5.86e+005 3.82e+000 5.80e-001 5.38e+006 1 1.26e+000 4.44e+001
31 2.502114e+007 2.67e+002 5.86e+005 3.84e+000 5.80e-001 5.41e+006 1 1.28e+000 4.57e+001
32 2.502087e+007 2.68e+002 5.86e+005 3.85e+000 5.81e-001 5.43e+006 1 1.27e+000 4.69e+001
33 2.502060e+007 2.69e+002 5.86e+005 3.87e+000 5.81e-001 5.45e+006 1 1.28e+000 4.82e+001
34 2.502033e+007 2.70e+002 5.86e+005 3.89e+000 5.82e-001 5.48e+006 1 1.24e+000 4.95e+001
35 2.502006e+007 2.72e+002 5.86e+005 3.90e+000 5.83e-001 5.50e+006 1 1.28e+000 5.07e+001
36 2.501979e+007 2.73e+002 5.85e+005 3.92e+000 5.83e-001 5.53e+006 1 1.23e+000 5.20e+001
37 2.501952e+007 2.74e+002 5.84e+005 3.94e+000 5.84e-001 5.55e+006 1 1.27e+000 5.32e+001
38 2.501924e+007 2.75e+002 5.84e+005 3.96e+000 5.85e-001 5.58e+006 1 1.47e+000 5.47e+001
39 2.501896e+007 2.77e+002 5.83e+005 3.98e+000 5.86e-001 5.61e+006 1 1.61e+000 5.63e+001
40 2.501869e+007 2.78e+002 5.82e+005 4.00e+000 5.87e-001 5.64e+006 1 1.42e+000 5.77e+001
41 2.501841e+007 2.80e+002 5.81e+005 4.02e+000 5.88e-001 5.67e+006 1 1.30e+000 5.90e+001
42 2.501812e+007 2.81e+002 5.79e+005 4.04e+000 5.90e-001 5.70e+006 1 1.37e+000 6.04e+001
43 2.501784e+007 2.83e+002 5.79e+005 4.07e+000 5.91e-001 5.74e+006 1 1.44e+000 6.18e+001
44 2.501756e+007 2.85e+002 5.79e+005 4.09e+000 5.92e-001 5.78e+006 1 1.42e+000 6.33e+001
45 2.501727e+007 2.86e+002 5.79e+005 4.12e+000 5.94e-001 5.81e+006 1 1.29e+000 6.46e+001
46 2.501698e+007 2.88e+002 5.79e+005 4.15e+000 5.95e-001 5.85e+006 1 1.29e+000 6.58e+001
47 2.501669e+007 2.90e+002 5.79e+005 4.18e+000 5.97e-001 5.90e+006 1 1.28e+000 6.71e+001
48 2.501640e+007 2.92e+002 5.79e+005 4.21e+000 5.98e-001 5.94e+006 1 1.29e+000 6.84e+001
49 2.501610e+007 2.95e+002 5.79e+005 4.24e+000 6.00e-001 5.99e+006 1 1.27e+000 6.97e+001
50 2.501581e+007 2.97e+002 5.79e+005 4.27e+000 6.02e-001 6.04e+006 1 1.28e+000 7.10e+001
51 2.501551e+007 2.99e+002 5.79e+005 4.31e+000 6.04e-001 6.09e+006 1 1.29e+000 7.23e+001
52 2.501521e+007 3.02e+002 5.79e+005 4.35e+000 6.05e-001 6.15e+006 1 1.29e+000 7.36e+001
……………………………………
491 2.487564e+007 4.68e+002 7.55e+005 7.07e+000 5.60e-001 6.13e+006 1 1.37e+000 6.56e+002
492 2.487517e+007 4.70e+002 7.55e+005 7.09e+000 5.60e-001 6.14e+006 1 1.34e+000 6.57e+002
493 2.487470e+007 4.71e+002 7.56e+005 7.11e+000 5.60e-001 6.15e+006 1 1.39e+000 6.58e+002
494 2.487422e+007 4.72e+002 7.56e+005 7.12e+000 5.60e-001 6.16e+006 1 1.31e+000 6.60e+002
495 2.487375e+007 4.73e+002 7.57e+005 7.14e+000 5.60e-001 6.17e+006 1 1.31e+000 6.61e+002
496 2.487328e+007 4.75e+002 7.57e+005 7.16e+000 5.60e-001 6.19e+006 1 1.32e+000 6.62e+002
497 2.487280e+007 4.76e+002 7.58e+005 7.18e+000 5.60e-001 6.20e+006 1 1.29e+000 6.64e+002
498 2.487232e+007 4.77e+002 7.58e+005 7.20e+000 5.60e-001 6.21e+006 1 1.30e+000 6.65e+002
499 2.487184e+007 4.78e+002 7.59e+005 7.22e+000 5.60e-001 6.22e+006 1 1.30e+000 6.66e+002
500 2.487136e+007 4.80e+002 7.59e+005 7.24e+000 5.60e-001 6.23e+006 1 1.31e+000 6.68e+002
Absolute Bundle Adjustment Report
---------------------------------
Residuals : 1591579
Parameters : 521610
Iterations : 500
Time : 667.579107 [s]
Initial cost : 3.965478 [px]
Final cost : 3.953081 [px]
Termination : No convergence