opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.36k stars 5.75k forks source link

A_reg det = 0 when solve estimateWarpNodes() for DynamicFusion #2639

Open schen119 opened 4 years ago

schen119 commented 4 years ago
System information (version)
Detailed description

The function estimateWarpNodes() for dynamicFusion implementation in module: opencv_contrib/modules/rgbd trys to solve A_reg*nodeTwists = b_reg where the nodeTwists is the target variable what to solve. But the det(A_reg) = 0 shown in line 450 when I run the code.

I already printout A_reg and confirm it is not zero matrix, i.e., some of elements are not zero. Theoretically, there is no unique solution when det(A_reg) = 0 Is it normal or there is some bug to obtain the A_reg?

Steps to reproduce

Run https://github.com/opencv/opencv_contrib/blob/master/modules/rgbd/samples/dynafu_demo.cpp And it will show in the log image

UnderscoreAsterisk commented 4 years ago

Hello,

I doubt that this is a bug with calculating A_reg in cv::determinant, I think it could be one of two things:

  1. The entries in A_reg are so small that when performing multiplication to calculate the determinant, the intermediate result becomes smaller than the possible precision. If this is the case, I would say that it is working as intended since small entries in A_reg might just be noise.
  2. Or, it might be the case that A_reg somehow becomes a singular matrix (which may contain non-zero entries). However, I believe this is somewhat unlikely to be the case because we factor out the common transformations earlier that might induce singularity.

In any case, if the determinant is 0, cv::solve tries to provide a pseudo-solution, which should result in a very small (almost if not completely zero) nodeTwists.