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.vfx@gmail.com>2012-11-05 12:04:27 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-11-05 12:04:27 +0400
commit3bd7816c75215a0c2dc47a9014adab9d6ca431db (patch)
treeac744cb91f4ba80dcc87bbaf36d2181c24862bf7 /source
parent008630abfc65ebc33be48f05a40694394f5be392 (diff)
Camera Tracking: allow fallback to reprojection resection by user demand
This fixes some "regressions" introduced in rev50781 which lead to much worse solution in some cases. Now it's possible to bring old behavior back. Perhaps it's more like temporal solution for time being smarter solution is found. But finding such a solution isn't so fast, so let's bring manual control over reprojection usage. But anyway, imo it's now nice to have a structure which could be used to pass different settings to the solver.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/tracking.c13
-rw-r--r--source/blender/blenloader/intern/readfile.c13
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c13
4 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 26775eaac8c..89446a1856f 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -173,6 +173,7 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
tracking->settings.default_search_size = 61;
tracking->settings.dist = 1;
tracking->settings.object_distance = 1;
+ tracking->settings.reconstruction_success_threshold = 1e-3;
tracking->stabilization.scaleinf = 1.0f;
tracking->stabilization.locinf = 1.0f;
@@ -2561,6 +2562,9 @@ typedef struct MovieReconstructContext {
TracksMap *tracks_map;
+ float success_threshold;
+ int use_fallback_reconstruction;
+
int sfra, efra;
} MovieReconstructContext;
@@ -2830,6 +2834,9 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
context->k2 = camera->k2;
context->k3 = camera->k3;
+ context->success_threshold = tracking->settings.reconstruction_success_threshold;
+ context->use_fallback_reconstruction = tracking->settings.reconstruction_flag & TRACKING_USE_FALLBACK_RECONSTRUCTION;
+
context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
track = tracksbase->first;
@@ -2929,12 +2936,18 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *
reconstruct_update_solve_cb, &progressdata);
}
else {
+ struct libmv_reconstructionOptions options;
+
+ options.success_threshold = context->success_threshold;
+ options.use_fallback_reconstruction = context->use_fallback_reconstruction;
+
context->reconstruction = libmv_solveReconstruction(context->tracks,
context->keyframe1, context->keyframe2,
context->refine_flags,
context->focal_length,
context->principal_point[0], context->principal_point[1],
context->k1, context->k2, context->k3,
+ &options,
reconstruct_update_solve_cb, &progressdata);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 44561e7c055..38213878ba1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8310,6 +8310,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ {
+ /* fallbck resection method settings */
+ {
+ MovieClip *clip;
+
+ for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+ if (clip->tracking.settings.reconstruction_success_threshold == 0.0f) {
+ clip->tracking.settings.reconstruction_success_threshold = 1e-3;
+ }
+ }
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index c6cefce2994..6b918ea2395 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -167,6 +167,9 @@ typedef struct MovieTrackingSettings {
* were moved to per-tracking object settings
*/
+ float reconstruction_success_threshold;
+ int reconstruction_flag;
+
/* which camera intrinsics to refine. uses on the REFINE_* flags */
short refine_camera_intrinsics, pad2;
@@ -224,6 +227,7 @@ typedef struct MovieTrackingObject {
ListBase tracks; /* list of tracks use to tracking this object */
MovieTrackingReconstruction reconstruction; /* reconstruction data for this object */
+ /* reconstruction options */
int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */
} MovieTrackingObject;
@@ -331,6 +335,9 @@ enum {
#define TRACKING_SPEED_QUARTER 4
#define TRACKING_SPEED_DOUBLE 5
+/* MovieTrackingObject->reconstruction_flag */
+#define TRACKING_USE_FALLBACK_RECONSTRUCTION (1 << 0)
+
/* MovieTrackingSettings->refine_camera_intrinsics */
#define REFINE_FOCAL_LENGTH (1 << 0)
#define REFINE_PRINCIPAL_POINT (1 << 1)
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 365b80b6d7c..51b50f78e66 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -574,6 +574,19 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
"Limit speed of tracking to make visual feedback easier "
"(this does not affect the tracking quality)");
+ /* reconstruction success_threshold */
+ prop = RNA_def_property(srna, "reconstruction_success_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_default(prop, 0.001f);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Success Threshold", "Threshold value of reconstruction error which is still considered successful");
+
+ /* use fallback reconstruction */
+ prop = RNA_def_property(srna, "use_fallback_reconstruction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "reconstruction_flag", TRACKING_USE_FALLBACK_RECONSTRUCTION);
+ RNA_def_property_ui_text(prop, "Use Fallback", "Use fallback reconstruction algorithm in cases main reconstruction algorithm failed. Could give better solution with bad tracks");
+
/* 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");