From c82f65b096b90d80ea50be40afa826e7368d87a2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 15 Mar 2021 15:48:15 +0100 Subject: Fix T86262: Tracking backwards fails after gap in track The issue was caused by a prediction algorithm detecting tracking the wrong way. Solved by passing tracking direction explicitly, so that prediction will always happen correctly regardless of the state of the Tracks context. --- source/blender/blenkernel/intern/tracking_region_tracker.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/tracking_region_tracker.c') diff --git a/source/blender/blenkernel/intern/tracking_region_tracker.c b/source/blender/blenkernel/intern/tracking_region_tracker.c index 68e866b355d..ef36acdc3d5 100644 --- a/source/blender/blenkernel/intern/tracking_region_tracker.c +++ b/source/blender/blenkernel/intern/tracking_region_tracker.c @@ -183,8 +183,11 @@ static ImBuf *tracking_context_get_reference_ibuf(MovieClip *clip, /* Fill in libmv tracker options structure with settings need to be used to perform track. */ void tracking_configure_tracker(const MovieTrackingTrack *track, float *mask, + const bool is_backwards, libmv_TrackRegionOptions *options) { + options->direction = is_backwards ? LIBMV_TRACK_REGION_BACKWARD : LIBMV_TRACK_REGION_FORWARD; + /* TODO(sergey): Use explicit conversion, so that options are decoupled between the Libmv library * and enumerator values in DNA. */ options->motion_model = track->motion_model; @@ -220,6 +223,7 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf, int reference_search_area_width, int reference_search_area_height, float *mask, + const bool is_backward, double dst_pixel_x[5], double dst_pixel_y[5]) { @@ -248,7 +252,7 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf, destination_ibuf, track, marker, &new_search_area_width, &new_search_area_height); /* configure the tracker */ - tracking_configure_tracker(track, mask, &options); + tracking_configure_tracker(track, mask, is_backward, &options); /* Convert the marker corners and center into pixel coordinates in the * search/destination images. */ @@ -374,6 +378,7 @@ void BKE_tracking_refine_marker(MovieClip *clip, search_area_width, search_area_height, mask, + backwards, dst_pixel_x, dst_pixel_y); -- cgit v1.2.3