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-04-28 18:54:45 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-04-28 18:54:45 +0400
commit51a4188105fa334b33162e3ed32f704311dda41b (patch)
tree09753bfb5278dcd4490eb28bbc7b6a728b298b81 /source
parent6e40b8b3cf33980d406bf8b6c405c112159926db (diff)
parent339efd5e0158706f3e0cd6251ee65c7446fc96ed (diff)
Camera tracking: support of tripod motion solving
Expose option into interface to use modal solver which currently supports only tripod motion. This solver requires two tracks at least to reconstruct motion. Using more tracks aren't improving solution in general, just adds instability into solution and slows down things a lot. Refirement of camera intrinsics was disabled due to it's not only refines camera intrinsics but also adjusts camera position which isn't necessary here To use this solver just activate "Tripod Motion" checkbox in solver panel. Merged from tomato: svn merge ^/branches/soc-2011-tomato -r45622:45624 -r46036:46037 P.S. Quite experimental yet, requires more checking and probably tweaks to prevent camera jumps when tracks apperars/disappears from the screen.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/tracking.c33
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h11
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c6
3 files changed, 38 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 7654c361d14..e511cd362de 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1523,6 +1523,7 @@ typedef struct MovieReconstructContext {
#endif
char object_name[MAX_NAME];
int is_camera;
+ short motion_flag;
float focal_length;
float principal_point[2];
@@ -1752,7 +1753,11 @@ int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *o
#if WITH_LIBMV
ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
- if (count_tracks_on_both_keyframes(tracking, tracksbase)<8) {
+ if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) {
+ /* TODO: check for number of tracks? */
+ return TRUE;
+ }
+ else if (count_tracks_on_both_keyframes(tracking, tracksbase) < 8) {
BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction", error_size);
return FALSE;
@@ -1781,7 +1786,8 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
MovieTrackingTrack *track;
BLI_strncpy(context->object_name, object->name, sizeof(context->object_name));
- context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
+ context->is_camera = object->flag & TRACKING_OBJECT_CAMERA;
+ context->motion_flag = tracking->settings.motion_flag;
context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
@@ -1894,13 +1900,22 @@ void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *
progressdata.stats_message = stats_message;
progressdata.message_size = message_size;
- 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,
- solve_reconstruction_update_cb, &progressdata);
+ if (context->motion_flag & TRACKING_MOTION_MODAL) {
+ context->reconstruction = libmv_solveModal(context->tracks,
+ context->focal_length,
+ context->principal_point[0], context->principal_point[1],
+ context->k1, context->k2, context->k3,
+ solve_reconstruction_update_cb, &progressdata);
+ }
+ else {
+ 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,
+ solve_reconstruction_update_cb, &progressdata);
+ }
error = libmv_reprojectionError(context->reconstruction);
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index 9c0f63028c1..2f099ed59f5 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -123,7 +123,7 @@ typedef struct MovieTrackingSettings {
short default_pattern_match; /* re-adjust every N frames */
short default_flag; /* default flags like color channels used by default */
- short pod;
+ short motion_flag; /* flags describes motion type */
/* ** common tracker settings ** */
short speed; /* speed of tracking */
@@ -131,8 +131,8 @@ typedef struct MovieTrackingSettings {
/* ** reconstruction settings ** */
int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */
- /* ** which camera intrinsics to refine. uses on the REFINE_* flags */
- short refine_camera_intrinsics, pad23;
+ /* which camera intrinsics to refine. uses on the REFINE_* flags */
+ short refine_camera_intrinsics, pad2;
/* ** tool settings ** */
@@ -243,6 +243,11 @@ enum {
/* MovieTrackingSettings->flag */
#define TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED (1<<0)
+/* MovieTrackingSettings->motion_flag */
+#define TRACKING_MOTION_TRIPOD (1<<0)
+
+#define TRACKING_MOTION_MODAL (TRACKING_MOTION_TRIPOD)
+
/* MovieTrackingSettings->speed */
#define TRACKING_SPEED_FASTEST 0
#define TRACKING_SPEED_REALTIME 1
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index c3a46c39643..85adf524717 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -607,6 +607,12 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ /* solver settings */
+ prop = RNA_def_property(srna, "use_tripod_solver", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "motion_flag", TRACKING_MOTION_TRIPOD);
+ RNA_def_property_ui_text(prop, "Tripod Motion", "Tracking footage is shooted by tripod camera and should use special sovler for this");
+
/* limit frames */
prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);