Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2020-10-21 11:53:13 +0300
committerSergey Sharybin <sergey@blender.org>2020-10-28 12:21:07 +0300
commit0269f0c574525128113877c1fcfee3682fc2cbca (patch)
treedf846c7a05b17c9be7570a1c6e1257a880965830 /source
parent1b1f46a98c9e80b250b02a39ec36384a2c111781 (diff)
Tracking: Simplify configuration of intrinsics to refine
Previously, only predefined and limited set of intrinsics combinations could have been refined. This was caused by a bundle adjustment library used in the early days of the solver. Now it is possible to fully customize which intrinsics are to be refined during camera solving. Internally solver supports per-parameter settings but in the interface they are grouped as following: * Focal length * Optical center * Radial distortion coefficients (which includes k1, k2, k3, k4) * Tangential distortion coefficients (which includes p1, p2) Differential Revision: https://developer.blender.org/D9294
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/tracking.c1
-rw-r--r--source/blender/blenkernel/intern/tracking_solver.c8
-rw-r--r--source/blender/blenloader/intern/versioning_290.c30
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c19
5 files changed, 51 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index cb33610a93f..7f927a8838e 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -338,6 +338,7 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
tracking->settings.default_weight = 1.0f;
tracking->settings.dist = 1;
tracking->settings.object_distance = 1;
+ tracking->settings.refine_camera_intrinsics = REFINE_NO_INTRINSICS;
tracking->stabilization.scaleinf = 1.0f;
tracking->stabilization.anchor_frame = 1;
diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c
index 7df8bf62b16..d89d36f85ea 100644
--- a/source/blender/blenkernel/intern/tracking_solver.c
+++ b/source/blender/blenkernel/intern/tracking_solver.c
@@ -291,12 +291,12 @@ static int reconstruct_refine_intrinsics_get_flags(MovieTracking *tracking,
flags |= LIBMV_REFINE_PRINCIPAL_POINT;
}
- if (refine & REFINE_RADIAL_DISTORTION_K1) {
- flags |= LIBMV_REFINE_RADIAL_DISTORTION_K1;
+ if (refine & REFINE_RADIAL_DISTORTION) {
+ flags |= LIBMV_REFINE_RADIAL_DISTORTION;
}
- if (refine & REFINE_RADIAL_DISTORTION_K2) {
- flags |= LIBMV_REFINE_RADIAL_DISTORTION_K2;
+ if (refine & REFINE_TANGENTIAL_DISTORTION) {
+ flags |= LIBMV_REFINE_TANGENTIAL_DISTORTION;
}
return flags;
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index f6bd9a3d00a..c3b85a011db 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -44,6 +44,7 @@
#include "DNA_rigidbody_types.h"
#include "DNA_screen_types.h"
#include "DNA_shader_fx_types.h"
+#include "DNA_tracking_types.h"
#include "DNA_workspace_types.h"
#include "BKE_animsys.h"
@@ -929,6 +930,35 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 292, 1)) {
+ {
+ const int LEGACY_REFINE_RADIAL_DISTORTION_K1 = (1 << 2);
+
+ LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingSettings *settings = &tracking->settings;
+ int new_refine_camera_intrinsics = 0;
+
+ if (settings->refine_camera_intrinsics & REFINE_FOCAL_LENGTH) {
+ new_refine_camera_intrinsics |= REFINE_FOCAL_LENGTH;
+ }
+
+ if (settings->refine_camera_intrinsics & REFINE_PRINCIPAL_POINT) {
+ new_refine_camera_intrinsics |= REFINE_PRINCIPAL_POINT;
+ }
+
+ /* The end goal is to enable radial distorion refinement if either K1 or K2 were set for
+ * refinement. It is enough to only check for L1 it was not possible to refine K2 without
+ * K1. */
+ if (settings->refine_camera_intrinsics & LEGACY_REFINE_RADIAL_DISTORTION_K1) {
+ new_refine_camera_intrinsics |= REFINE_RADIAL_DISTORTION;
+ }
+
+ settings->refine_camera_intrinsics = new_refine_camera_intrinsics;
+ }
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index d0105cda1ea..0bbeabf130f 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -288,8 +288,7 @@ typedef struct MovieTrackingSettings {
int reconstruction_flag;
/* which camera intrinsics to refine. uses on the REFINE_* flags */
- short refine_camera_intrinsics;
- char _pad2[2];
+ int refine_camera_intrinsics;
/* ** tool settings ** */
@@ -551,10 +550,12 @@ enum {
/* MovieTrackingSettings->refine_camera_intrinsics */
enum {
+ REFINE_NO_INTRINSICS = (0),
+
REFINE_FOCAL_LENGTH = (1 << 0),
REFINE_PRINCIPAL_POINT = (1 << 1),
- REFINE_RADIAL_DISTORTION_K1 = (1 << 2),
- REFINE_RADIAL_DISTORTION_K2 = (1 << 4),
+ REFINE_RADIAL_DISTORTION = (1 << 2),
+ REFINE_TANGENTIAL_DISTORTION = (1 << 3),
};
/* MovieTrackingStrabilization->flag */
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 17a7ab63077..effea4d5c8f 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -924,19 +924,22 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
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);
+ prop = RNA_def_property(srna, "refine_intrinsics_radial_distortion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "refine_camera_intrinsics", REFINE_RADIAL_DISTORTION);
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");
+ RNA_def_property_ui_text(prop,
+ "Refine Radial",
+ "Refine radial coefficients of distortion model during camera solving");
- prop = RNA_def_property(srna, "refine_intrinsics_k2", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(
+ srna, "refine_intrinsics_tangential_distortion", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
- prop, NULL, "refine_camera_intrinsics", REFINE_RADIAL_DISTORTION_K2);
+ prop, NULL, "refine_camera_intrinsics", REFINE_TANGENTIAL_DISTORTION);
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");
+ prop,
+ "Refine Tangential",
+ "Refine tangential coefficients of distortion model during camera solving");
/* tool settings */