ceres在优化过程中保持指定参数块不变
在solve前利用SetParameterBlockConstant()设置想固定不变的参数块
example:
//添加误差方程
ceres::CostFunction* cost_function = nullptr;
cost_function = BundleAdjustmentGCPsCostFunction::Create(px, py, ptGCP.second.x_c, ptGCP.second.y_c, ptGCP.second.z_c, m_BAoption.GCPsWeight);
m_problem->AddResidualBlock(cost_function, nullptr, pEO + imgIndex[imgID] * 6, &pf, pIO, pDistort);
//不优化 f,IOs,distort
if (m_BAoption.refine_f == false) {
m_problem->SetParameterBlockConstant(&pf);
}
if (m_BAoption.refine_IOs == false) {
m_problem->SetParameterBlockConstant(pIO);
}
if (m_BAoption.refine_distort == false) {
m_problem->SetParameterBlockConstant(pDistort);
}