diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-06-30 12:09:19 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-06-30 12:10:19 +0300 |
commit | c64d1b23df877178671e073a264536bdbfba28bb (patch) | |
tree | 0b23cf0c027f3b0dd275e80e04a7c6f00fa392a0 /source/blender/compositor/operations | |
parent | b544225202793435c54f63080a2bbd098727654d (diff) |
Fix numerical issues with plane track compositor node with empty input
No changes in the interface, but avoids spam in the console about
inability to find a solution for homography transform from singularity.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r-- | source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc index 8bf8e339697..ddda02c5e80 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc @@ -66,9 +66,18 @@ void PlaneDistortWarpImageOperation::calculate_corners(const float corners[4][2] const NodeOperation *image = get_input_operation(0); const int width = image->get_width(); const int height = image->get_height(); + + MotionSample *sample_data = &samples_[sample]; + + /* If the image which is to be warped empty assume unit transform and don't attempt to calculate + * actual homography (otherwise homography solver will attempt to deal with singularity). */ + if (width == 0 || height == 0) { + unit_m3(sample_data->perspective_matrix); + return; + } + float frame_corners[4][2] = { {0.0f, 0.0f}, {(float)width, 0.0f}, {(float)width, (float)height}, {0.0f, (float)height}}; - MotionSample *sample_data = &samples_[sample]; BKE_tracking_homography_between_two_quads( sample_data->frame_space_corners, frame_corners, sample_data->perspective_matrix); } |