diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-09 20:38:43 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-09 20:38:43 +0400 |
commit | 4f5f97254c06e0043b34df9a689dc45899c011cc (patch) | |
tree | 4f3c11d4a59a08f5ffc5a925eb23d3706d52d2c1 /source/blender/blenkernel/intern/tracking.c | |
parent | 522eeaa6a0cd41f9193e42afb1907743101810c9 (diff) |
Reconstructed scene scale ambiguity improvement
Made it so reconstructed scene always scaled in a way
that variance of camera centers is unity.
This solves "issues" when different keyframes will
give the same reprojection error but will give scenes
with different.scale, which could easily have been
considered as a bad keyframe combination.
This change is essential for automatic keyframe
selection algorithm to work reliable for user.
Diffstat (limited to 'source/blender/blenkernel/intern/tracking.c')
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index c202a210de7..37979326215 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2834,18 +2834,29 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M float mat[4][4]; float error = libmv_reporojectionErrorForImage(libmv_reconstruction, a); - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) mat[i][j] = matd[i][j]; + } + /* Ensure first camera has got zero rotation and transform. + * This is essential for object tracking to work -- this way + * we'll always know object and environment are properly + * oriented. + * + * There's one weak part tho, which is requirement object + * motion starts at the same frame as camera motion does, + * otherwise that;' be a russian roulette whether object is + * aligned correct or not. + */ if (!origin_set) { - copy_m4_m4(imat, mat); - invert_m4(imat); + invert_m4_m4(imat, mat); + unit_m4(mat); origin_set = TRUE; } - - if (origin_set) + else { mult_m4_m4m4(mat, imat, mat); + } copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat); reconstructed[reconstruction->camnr].framenr = a; |