diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-25 13:24:31 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-25 13:24:31 +0400 |
commit | 12baa00b6a9aef7622f46b572bef0be9af4d647d (patch) | |
tree | 3eedb53d931c04b877e9a97914e812511b873f40 /source/blender/blenkernel | |
parent | 66cca267b151f512ab9487615e86dd012423016b (diff) |
code cleanup: camera tracking
- Moved keyframes and refirement flags into reconstruction options structure
- Moved distortion coefficients and other camera intrinsics into own structure
- Cleaned up reconstruction functions in libmv c-api
---
svn merge -r52853:52854 ^/branches/soc-2011-tomato
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 1a7458f531c..de0be829e8b 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2996,6 +2996,31 @@ static void reconstruct_update_solve_cb(void *customdata, double progress, const BLI_snprintf(progressdata->stats_message, progressdata->message_size, "Solving camera | %s", message); } + +static void camraIntrincicsOptionsFromContext(libmv_cameraIntrinsicsOptions *camera_intrinsics_options, + MovieReconstructContext *context) +{ + camera_intrinsics_options->focal_length = context->focal_length; + + camera_intrinsics_options->principal_point_x = context->principal_point[0]; + camera_intrinsics_options->principal_point_y = context->principal_point[1]; + + camera_intrinsics_options->k1 = context->k1; + camera_intrinsics_options->k2 = context->k2; + camera_intrinsics_options->k3 = context->k3; +} + +static void reconstructionOptionsFromContext(libmv_reconstructionOptions *reconstruction_options, + MovieReconstructContext *context) +{ + reconstruction_options->keyframe1 = context->keyframe1; + reconstruction_options->keyframe2 = context->keyframe2; + + reconstruction_options->refine_intrinsics = context->refine_flags; + + reconstruction_options->success_threshold = context->success_threshold; + reconstruction_options->use_fallback_reconstruction = context->use_fallback_reconstruction; +} #endif void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *stop, short *do_update, @@ -3006,32 +3031,27 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short * ReconstructProgressData progressdata; + libmv_cameraIntrinsicsOptions camera_intrinsics_options; + libmv_reconstructionOptions reconstruction_options; + progressdata.stop = stop; progressdata.do_update = do_update; progressdata.progress = progress; progressdata.stats_message = stats_message; progressdata.message_size = message_size; + camraIntrincicsOptionsFromContext(&camera_intrinsics_options, context); + reconstructionOptionsFromContext(&reconstruction_options, context); + 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, + &camera_intrinsics_options, 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, + &camera_intrinsics_options, + &reconstruction_options, reconstruct_update_solve_cb, &progressdata); } |