[Bf-blender-cvs] [283c7fecf9b] master: Tracking: Decouple refine settings

Sergey Sharybin noreply at git.blender.org
Wed Oct 28 10:23:44 CET 2020


Commit: 283c7fecf9b904fad64f1831eeb5379d89ba5c56
Author: Sergey Sharybin
Date:   Tue Oct 20 17:53:12 2020 +0200
Branches: master
https://developer.blender.org/rB283c7fecf9b904fad64f1831eeb5379d89ba5c56

Tracking: Decouple refine settings

Historically the refine options had a hardcoded list of possibilities.
This was caused by an old bundle adjustment code which did not support
all possible combinations.

Now the bundle adjuster is based on Ceres solver, allowing to refine
anything in any combination.

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

M	release/scripts/startup/bl_ui/space_clip.py
M	source/blender/makesrna/intern/rna_tracking.c

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

diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 4b24f36eace..67d3db7d871 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -545,9 +545,12 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
         col.prop(tracking_object, "keyframe_a")
         col.prop(tracking_object, "keyframe_b")
 
-        col = layout.column()
+        col = layout.column(heading="Refine", align=True)
         col.active = tracking_object.is_camera
-        col.prop(settings, "refine_intrinsics", text="Refine")
+        col.prop(settings, "refine_intrinsics_focal_length", text="Focal Length")
+        col.prop(settings, "refine_intrinsics_principal_point", text="Principal Point")
+        col.prop(settings, "refine_intrinsics_k1", text="K1")
+        col.prop(settings, "refine_intrinsics_k2", text="K2")
 
         col = layout.column(align=True)
         col.scale_y = 2.0
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 6d90a76a2c0..17a7ab63077 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -889,38 +889,6 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
       {0, NULL, 0, NULL, NULL},
   };
 
-  static const EnumPropertyItem refine_items[] = {
-      {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
-      {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
-      {REFINE_FOCAL_LENGTH | REFINE_RADIAL_DISTORTION_K1,
-       "FOCAL_LENGTH_RADIAL_K1",
-       0,
-       "Focal length, K1",
-       "Refine focal length and radial distortion K1"},
-      {REFINE_FOCAL_LENGTH | REFINE_RADIAL_DISTORTION_K1 | REFINE_RADIAL_DISTORTION_K2,
-       "FOCAL_LENGTH_RADIAL_K1_K2",
-       0,
-       "Focal length, K1, K2",
-       "Refine focal length and radial distortion K1 and K2"},
-      {REFINE_FOCAL_LENGTH | REFINE_PRINCIPAL_POINT | REFINE_RADIAL_DISTORTION_K1 |
-           REFINE_RADIAL_DISTORTION_K2,
-       "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2",
-       0,
-       "Focal Length, Optical Center, K1, K2",
-       "Refine focal length, optical center and radial distortion K1 and K2"},
-      {REFINE_FOCAL_LENGTH | REFINE_PRINCIPAL_POINT,
-       "FOCAL_LENGTH_PRINCIPAL_POINT",
-       0,
-       "Focal Length, Optical Center",
-       "Refine focal length and optical center"},
-      {REFINE_RADIAL_DISTORTION_K1 | REFINE_RADIAL_DISTORTION_K2,
-       "RADIAL_K1_K2",
-       0,
-       "K1, K2",
-       "Refine radial distortion K1 and K2"},
-      {0, NULL, 0, NULL, NULL},
-  };
-
   srna = RNA_def_struct(brna, "MovieTrackingSettings", NULL);
   RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings");
 
@@ -943,11 +911,32 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
                            "Automatically select keyframes when solving camera/object motion");
 
   /* intrinsics refinement during bundle adjustment */
-  prop = RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
+
+  prop = RNA_def_property(srna, "refine_intrinsics_focal_length", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "refine_camera_intrinsics", REFINE_FOCAL_LENGTH);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-  RNA_def_property_enum_items(prop, refine_items);
-  RNA_def_property_ui_text(prop, "Refine", "Refine intrinsics during camera solving");
+  RNA_def_property_ui_text(
+      prop, "Refine Focal Length", "Refine focal length during camera solving");
+
+  prop = RNA_def_property(srna, "refine_intrinsics_principal_point", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "refine_camera_intrinsics", REFINE_PRINCIPAL_POINT);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(
+      prop, "Refine Principal Point", "Refine principal point during camera solving");
+
+  prop = RNA_def_property(srna, "refine_intrinsics_k1", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(
+      prop, NULL, "refine_camera_intrinsics", REFINE_RADIAL_DISTORTION_K1);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(
+      prop, "Refine K1", "Refine K1 coefficient of distortion model during camera solving");
+
+  prop = RNA_def_property(srna, "refine_intrinsics_k2", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(
+      prop, NULL, "refine_camera_intrinsics", REFINE_RADIAL_DISTORTION_K2);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(
+      prop, "Refine K2", "Refine K2 coefficient of distortion model during camera solving");
 
   /* tool settings */



More information about the Bf-blender-cvs mailing list