-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the equation right hand side is wrong #7
Comments
Hi, I'm not sure I can follow (and I'm not sure I can remember everything about my code :) Do you have references for your suggestion? Are you referring to the addition of the second order derivatives in x and y direction |
Hi, I'm referring to the addition of the second order derivative poisson-solver.cpp, line 203-204
The correct addend should be the sum of the projection of the guidance field on all vector pq. You could refer to the paper you implemented this algorithm from mentioned in readme. The addend is specified therein as equation (11) in section 3. I'll try to submit a pull request if it helps :) |
Ah, now I think I know what you are refering to. Equation 11 however refers to the numerical estimation of the gradient (see equation 9) in an image through subtracting neighboring pixels in the source image. This is already accounted for in the kernels for the first order and second order derivatives
It differs from equation 11 in that the gradient for a pixel p in x-direction is computed symmetrically from image g as follows In case you are concerned about the projection on the oriented edge, right beneath equation 11 it says that the gradient of the source image is already considered the projection on the oriented edge, which is why, I think, I haven't considered any other projection. It seems in the original paper they suggest to compute the discrete gradient in every direction, i.e for every p take all q pixels in the neighborhood of p. That's probably something I haven't followed very strictly. |
Even without the 0.5 scaling, it would still be incorrect. The reason is the neighbors of p are on different sides of p, thus the sum of all these projections, according to equation 11, is 4*g(p) - \Sigma_q(g(q)). Note that for the 'northern' and 'eastern' neighbor, this projection is actually the opposite of the gradient at p. While in the source code, it is the value of the variable "f" at point p, which is the value of the Laplacian. I wonder how your implementation turns out, as it doesn't really work when I tried, which led me to trace the error and found what I believe is the problem. After I made this correction, the code works just fine. :) |
Yes you are right! Interesting, never experienced an issue in my tests. |
Actually, the direction of 'northern' and 'eastern' neighbor is still correct by taking that kernel: The direction is still correct, the only issue is the |
I went through and trialed the code and found an error:
From clone.cpp line 167-174
Here the divergence of the guidance field (i.e. Laplacian of g) is added to the right hand side of the linear system. However, the addend should be the sum of all (g_p - g_q), which is not the same with the Laplacian.
The text was updated successfully, but these errors were encountered: