diff options
author | Ivan Perevala <ivpe> | 2020-09-30 16:12:14 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2020-09-30 16:54:24 +0300 |
commit | 3a7d62cd1f5e06e22af1642fc5f4aab59bace585 (patch) | |
tree | d2832d6dacf16938c709e395a3220f2c64ee18e7 /source/blender/blenkernel/intern/movieclip.c | |
parent | 5ac477805637f20b8ac5e742457fa8f304066d83 (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/movieclip.c')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 12 |
1 files changed, 12 insertions, 0 deletions
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 { |