From c64d1b23df877178671e073a264536bdbfba28bb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 30 Jun 2022 11:09:19 +0200 Subject: 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. --- .../compositor/operations/COM_PlaneDistortCommonOperation.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/compositor/operations') 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); } -- cgit v1.2.3