From 57b31e2d4b451220059f5fb77abdf7f8ee2b9148 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Tue, 26 Nov 2024 16:19:47 +0300 Subject: [PATCH] calib3d: fix vector access in USAC --- modules/3d/src/usac/fundamental_solver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/3d/src/usac/fundamental_solver.cpp b/modules/3d/src/usac/fundamental_solver.cpp index a5e3b30fba..d2fb6d3d10 100644 --- a/modules/3d/src/usac/fundamental_solver.cpp +++ b/modules/3d/src/usac/fundamental_solver.cpp @@ -579,7 +579,7 @@ public: CameraPose pose; pose.R = corr_idx < 2 ? R1 : R2; pose.t = corr_idx % 2 == 1 ? -t : t; - refine_relpose(calib_points, sample, sample_size, &pose, opt, &weights[0]); + refine_relpose(calib_points, sample, sample_size, &pose, opt, weights.empty() ? nullptr : &weights[0]); Matx33d model_new = Math::getSkewSymmetric(pose.t) * pose.R; if (is_fundamental) model_new = K2_inv_t * model_new * K1_inv;