From 92f6e60f46b4f4db04a3b9a49b9429a027148ee7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Jul 2019 12:26:47 +0200 Subject: Fix T67876: 2D Stabilization doesn't compensate rotation in spacial cases This was caused by 2D stabilization trying to be smart and lower weight of tracks which are too close to the rotation center. This was causing algorithm to ignore a single track which was set to constant 1 weight and used for rotation compensation. It is quite tricky to quantify this change without having comprehensive regression suit, so can only hope that initial intention is still working as expected. --- source/blender/blenkernel/intern/tracking_stabilize.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c index b852e8a12cd..fa2399dd989 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.c +++ b/source/blender/blenkernel/intern/tracking_stabilize.c @@ -611,16 +611,19 @@ static bool average_track_contributions(StabContext *ctx, float rotation, scale, quality; quality = rotation_contribution( stabilization_base, marker, aspect, r_pivot, &rotation, &scale); - weight *= quality; - weight_sum += weight; - *r_angle += rotation * weight; + const float quality_weight = weight * quality; + weight_sum += quality_weight; + *r_angle += rotation * quality_weight; if (stab->flag & TRACKING_STABILIZE_SCALE) { - *r_scale_step += logf(scale) * weight; + *r_scale_step += logf(scale) * quality_weight; } else { *r_scale_step = 0; } - ok |= (weight_sum > EPSILON_WEIGHT); + /* NOTE: Use original marker weight and not the scaled one with the proximity here to allow + * simple stabilization setups when there is a single track in a close proximity of the + * center. */ + ok |= (weight > EPSILON_WEIGHT); } } } -- cgit v1.2.3