sobfu icon indicating copy to clipboard operation
sobfu copied to clipboard

Potential mathmatics error

Open PascalYIN opened this issue 6 years ago • 1 comments

Hello, I'm re-reading the Sobolev fusion paper and I was confused by the Sobolev approximation part. So I re-read your code for a better comprehension, then I found the way that you calculate the laplacien matrix is weird : `cv::Mat L_mat = -6.f * cv::Mat::eye(s3, s3, CV_32FC1); for (int i = 0; i <= static_cast(pow(params.s, 3)) - 1; ++i) { int idx_z = i / (params.s * params.s); int idx_y = (i - idx_z * params.s * params.s) / params.s; int idx_x = i - params.s * (idx_y + params.s * idx_z); if (idx_x + 1 < params.s) { int pos = (idx_x + 1) + idx_y * params.s + idx_z * params.s * params.s; L_mat.at(i, pos) = 1.f; } if (idx_x - 1 >= 0) { int pos = (idx_x - 1) + idx_y * params.s + idx_z * params.s * params.s; L_mat.at(i, pos) = 1.f; }

    if (idx_y + 1 < params.s) {
        int pos                 = idx_x + (idx_y + 1) * params.s + idx_z * params.s * params.s;
        L_mat.at<float>(i, pos) = 1.f;
    }
    if (idx_y - 1 >= 0) {
        int pos                 = idx_x + (idx_y - 1) * params.s + idx_z * params.s * params.s;
        L_mat.at<float>(i, pos) = 1.f;
    }

    if (idx_z + 1 < params.s) {
        int pos                 = idx_x + idx_y * params.s + (idx_z + 1) * params.s * params.s;
        L_mat.at<float>(i, pos) = 1.f;
    }
    if (idx_z - 1 >= 0) {
        int pos                 = idx_x + idx_y * params.s + (idx_z - 1) * params.s * params.s;
        L_mat.at<float>(i, pos) = 1.f;
    }
}`

I checked the definition of laplacian matrix on wikipedia, image As the diagonal of tha laplacian matrix should be the row-wise sum of the correspondant adjacency matrix, it shouldn't be -6 for all, and the L_mat.at<float>(i,pos) should be -1.f, am I right?

PascalYIN avatar Sep 02 '19 15:09 PascalYIN

here's a document that shows how to construct a sparse Laplacian matrix for a 3D grid: https://www.12000.org/my_notes/mma_matlab_control/KERNEL/KEse83.htm why would the diagonal of L be the row-wise sum of the adjacency matrix, and not simply be equal to the diagonal of the adjacency matrix?

dgrzech avatar Oct 30 '19 14:10 dgrzech