diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-03-15 17:48:15 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-03-15 17:55:09 +0300 |
commit | c82f65b096b90d80ea50be40afa826e7368d87a2 (patch) | |
tree | da618e3f78956310a3cf2a74c614e2d15bba4a6b /source/blender/blenkernel/intern/tracking_region_tracker.c | |
parent | 618c4b9daf216eb5d287fc7725d9154e21378219 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/tracking_region_tracker.c')
-rw-r--r-- | source/blender/blenkernel/intern/tracking_region_tracker.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); |