From 3a7d62cd1f5e06e22af1642fc5f4aab59bace585 Mon Sep 17 00:00:00 2001 From: Ivan Perevala Date: Wed, 30 Sep 2020 15:12:14 +0200 Subject: Tracking: Implement Brown-Conrady distortion model Implemented Brown-Conrady lens distortion model with 4 radial and 2 tangential coefficients to improve compatibility with other software, such as Agisoft Photoscan/Metashapes, 3DF Zephir, RealityCapture, Bentley ContextCapture, Alisevision Meshroom(opensource). Also older programs: Bundler, CPMVS. In general terms, most photogrammetric software. The new model is available under the distortion model menu in Lens settings. For tests and demos check the original patch. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9037 --- source/blender/blenkernel/intern/movieclip.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/blenkernel/intern/movieclip.c') diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 3ea0f800178..364e6c9bfe4 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -687,6 +687,8 @@ typedef struct MovieClipCache { float polynomial_k[3]; float division_k[2]; float nuke_k[2]; + float brown_k[4]; + float brown_p[2]; short distortion_model; bool undistortion_used; @@ -1134,10 +1136,18 @@ static bool check_undistortion_cache_flags(const MovieClip *clip) if (!equals_v2v2(&camera->division_k1, cache->postprocessed.division_k)) { return false; } + if (!equals_v2v2(&camera->nuke_k1, cache->postprocessed.nuke_k)) { return false; } + if (!equals_v4v4(&camera->brown_k1, cache->postprocessed.brown_k)) { + return false; + } + if (!equals_v2v2(&camera->brown_p1, cache->postprocessed.brown_p)) { + return false; + } + return true; } @@ -1240,6 +1250,8 @@ static void put_postprocessed_frame_to_cache( copy_v3_v3(cache->postprocessed.polynomial_k, &camera->k1); copy_v2_v2(cache->postprocessed.division_k, &camera->division_k1); copy_v2_v2(cache->postprocessed.nuke_k, &camera->nuke_k1); + copy_v4_v4(cache->postprocessed.brown_k, &camera->brown_k1); + copy_v2_v2(cache->postprocessed.brown_p, &camera->brown_p1); cache->postprocessed.undistortion_used = true; } else { -- cgit v1.2.3