[Bf-blender-cvs] [c64d1b23df8] master: Fix numerical issues with plane track compositor node with empty input
Sergey Sharybin
noreply at git.blender.org
Thu Jun 30 11:10:24 CEST 2022
Commit: c64d1b23df877178671e073a264536bdbfba28bb
Author: Sergey Sharybin
Date: Thu Jun 30 11:09:19 2022 +0200
Branches: master
https://developer.blender.org/rBc64d1b23df877178671e073a264536bdbfba28bb
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.
===================================================================
M source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc
===================================================================
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);
}
More information about the Bf-blender-cvs
mailing list