Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LM #8

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "camera-intrinsic-calibration"
version = "0.5.2"
version = "0.5.3"
edition = "2021"
authors = ["Powei Lin <poweilin1994@gmail.com>"]
readme = "README.md"
Expand All @@ -21,7 +21,7 @@ exclude = [
]

[dependencies]
aprilgrid = "0.4.3"
aprilgrid = "0.5.1"
camera-intrinsic-model = "0.3.1"
clap = { version = "4.5.23", features = ["derive"] }
colorous = "1.0.15"
Expand All @@ -38,10 +38,10 @@ rand_chacha = "0.3.1"
rayon = "1.10.0"
rerun = "0.17.0"
serde = { version = "1.0.216", features = ["derive"] }
serde_json = "1.0.133"
serde_json = "1.0.134"
sqpnp_simple = "0.1.5"
time = "0.3.37"
tiny-solver = "0.12.1"
tiny-solver = "0.13.0"

[[bin]]
name = "ccrs"
Expand Down
10 changes: 5 additions & 5 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub fn convert_model(
HashMap::<String, na::DVector<f64>>::from([("params".to_string(), target_params_init)]);

// initialize optimizer
let optimizer = tiny_solver::GaussNewtonOptimizer {};
let optimizer = tiny_solver::LevenbergMarquardtOptimizer::default();

// distortion parameter bound
set_problem_parameter_bound("params", &mut problem, target_model, false);
Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn init_ucm(
]);

// initialize optimizer
let optimizer = tiny_solver::GaussNewtonOptimizer {};
let optimizer = tiny_solver::LevenbergMarquardtOptimizer::default();
if fixed_focal {
init_focal_alpha_problem.fix_variable("params", 0);
}
Expand Down Expand Up @@ -407,7 +407,7 @@ pub fn calib_camera(
}
}

let optimizer = tiny_solver::GaussNewtonOptimizer {};
let optimizer = tiny_solver::LevenbergMarquardtOptimizer::default();
// let initial_values = optimizer.optimize(&problem, &initial_values, None);

set_problem_parameter_bound("params", &mut problem, generic_camera, xy_same_focal);
Expand Down Expand Up @@ -513,7 +513,7 @@ pub fn init_camera_extrinsic(cam_rtvecs: &[HashMap<usize, RvecTvec>]) -> Vec<Rve
("tvec".to_string(), tvec),
]);

let optimizer = tiny_solver::GaussNewtonOptimizer {};
let optimizer = tiny_solver::LevenbergMarquardtOptimizer::default();
let result = optimizer.optimize(&problem, &initial_values, None).unwrap();
println!("extrinsic cam{} cam0", cam_i);
println!("rvec: {}", result["rvec"]);
Expand Down Expand Up @@ -629,7 +629,7 @@ pub fn calib_all_camera_with_extrinsics(
println!("set focal");
problem.fix_variable("params0", 0);
}
let optimizer = tiny_solver::GaussNewtonOptimizer {};
let optimizer = tiny_solver::LevenbergMarquardtOptimizer::default();

let result_option = optimizer.optimize(&problem, &initial_values, None);
if let Some(mut result) = result_option {
Expand Down