diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-14 10:41:23 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-14 10:41:23 +0400 |
commit | 6fbc4186fd947d5dd408fccea1ba4990be738880 (patch) | |
tree | 4bec14f6df0110253ef796dc45f02ff92968cf53 /source/blender/editors/space_clip | |
parent | e058110b700d556710509d20deac778a6b4d566f (diff) |
Assorted camera tracker improvements
- Add support for refining the camera's intrinsic parameters
during a solve. Currently, refining supports only the following
combinations of intrinsic parameters:
f
f, cx, cy
f, cx, cy, k1, k2
f, k1
f, k1, k2
This is not the same as autocalibration, since the user must
still make a reasonable initial guess about the focal length and
other parameters, whereas true autocalibration would eliminate
the need for the user specify intrinsic parameters at all.
However, the solver works well with only rough guesses for the
focal length, so perhaps full autocalibation is not that
important.
Adding support for the last two combinations, (f, k1) and (f,
k1, k2) required changes to the library libmv depends on for
bundle adjustment, SSBA. These changes should get ported
upstream not just to libmv but to SSBA as well.
- Improved the region of convergence for bundle adjustment by
increasing the number of Levenberg-Marquardt iterations from 50
to 500. This way, the solver is able to crawl out of the bad
local minima it gets stuck in when changing from, for example,
bundling k1 and k2 to just k1 and resetting k2 to 0.
- Add several new region tracker implementations. A region tracker
is a libmv concept, which refers to tracking a template image
pattern through frames. The impact to end users is that tracking
should "just work better". I am reserving a more detailed
writeup, and maybe a paper, for later.
- Other libmv tweaks, such as detecting that a tracker is headed
outside of the image bounds.
This includes several changes made directly to the libmv extern
code rather expecting to get those changes through normal libmv
channels, because I, the libmv BDFL, decided it was faster to work
on libmv directly in Blender, then later reverse-port the libmv
changes from Blender back into libmv trunk. The interesting part
is that I added a full Levenberg-Marquardt loop to the region
tracking code, which should lead to a more stable solutions. I
also added a hacky implementation of "Efficient Second-Order
Minimization" for tracking, which works nicely. A more detailed
quantitative evaluation will follow.
Original patch by Keir, cleaned a bit by myself.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index e9006f5b1e9..1b08a9aee4c 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1504,24 +1504,6 @@ void CLIP_OT_track_markers(wmOperatorType *ot) /********************** solve camera operator *********************/ -static int check_solve_track_count(MovieTracking *tracking) -{ - int tot= 0; - int frame1= tracking->settings.keyframe1, frame2= tracking->settings.keyframe2; - MovieTrackingTrack *track; - - track= tracking->tracks.first; - while(track) { - if(BKE_tracking_has_marker(track, frame1)) - if(BKE_tracking_has_marker(track, frame2)) - tot++; - - track= track->next; - } - - return tot>=8; -} - static int solve_camera_exec(bContext *C, wmOperator *op) { SpaceClip *sc= CTX_wm_space_clip(C); @@ -1530,9 +1512,11 @@ static int solve_camera_exec(bContext *C, wmOperator *op) MovieTracking *tracking= &clip->tracking; int width, height; float error; + char error_msg[255]; + + if(!BKE_tracking_can_solve(tracking, error_msg, sizeof(error_msg))) { + BKE_report(op->reports, RPT_ERROR, error_msg); - if(!check_solve_track_count(tracking)) { - BKE_report(op->reports, RPT_ERROR, "At least 8 tracks on both of keyframes are needed for reconstruction"); return OPERATOR_CANCELLED; } |