[Bf-blender-cvs] [7e836bde11c] master: Fix critical lens distortion bug in libmv after rB3a7d62cd1f5e.

Bastien Montagne noreply at git.blender.org
Mon Oct 5 11:59:58 CEST 2020


Commit: 7e836bde11ce6521953c9f246cacd442a3ef6c0e
Author: Bastien Montagne
Date:   Mon Oct 5 11:40:22 2020 +0200
Branches: master
https://developer.blender.org/rB7e836bde11ce6521953c9f246cacd442a3ef6c0e

Fix critical lens distortion bug in libmv after rB3a7d62cd1f5e.

Current libmv_modal_solver_test fails since rB3a7d62cd1f5e.

It appears that the issue is caused by the insertion of the new OFFSET_K4 parameter,
as, if camera intrinsics are not required to implement/use all of those deform
parameters, they absolutely have to keep order (values) matching those defined
in bundle.cc, otherwise `PackIntrinisicsIntoArray` and `UnpackIntrinsicsFromArray`
will mangle them around.

===================================================================

M	intern/libmv/libmv/simple_pipeline/bundle.cc
M	intern/libmv/libmv/simple_pipeline/camera_intrinsics.h

===================================================================

diff --git a/intern/libmv/libmv/simple_pipeline/bundle.cc b/intern/libmv/libmv/simple_pipeline/bundle.cc
index c055846318a..4e76ae1f473 100644
--- a/intern/libmv/libmv/simple_pipeline/bundle.cc
+++ b/intern/libmv/libmv/simple_pipeline/bundle.cc
@@ -47,6 +47,10 @@ enum {
   OFFSET_PRINCIPAL_POINT_Y,
 
   // Distortion model coefficients.
+  // WARNING: camera intrinsics are not required to define/use all of those,
+  // but they have to define all of them up to the last one they need, in that
+  // exact same order. See e.g. how `PolynomialCameraIntrinsics` needs to define
+  // `OFFSET_K4`, even though it does not use it.
   OFFSET_K1,
   OFFSET_K2,
   OFFSET_K3,
diff --git a/intern/libmv/libmv/simple_pipeline/camera_intrinsics.h b/intern/libmv/libmv/simple_pipeline/camera_intrinsics.h
index cf0bdb76ccb..60ad1b5b8de 100644
--- a/intern/libmv/libmv/simple_pipeline/camera_intrinsics.h
+++ b/intern/libmv/libmv/simple_pipeline/camera_intrinsics.h
@@ -281,6 +281,7 @@ class PolynomialCameraIntrinsics : public CameraIntrinsics {
     OFFSET_K1,
     OFFSET_K2,
     OFFSET_K3,
+    OFFSET_K4,  // Unused, needed to map properly with all deform parameters defined in bundle.cc.
     OFFSET_P1,
     OFFSET_P2,



More information about the Bf-blender-cvs mailing list