yqueau / normal_integration

Matlab codes for integrating the normal (gradient) field of a surface over a 2D grid
GNU General Public License v3.0
56 stars 13 forks source link

Typo in anisotropic diffusion's implementation? #6

Closed xucao-42 closed 2 years ago

xucao-42 commented 2 years ago

Hi there,

I was recently re-implementing your normal integration codes, and I just realize there may be a typo in the anisotropic diffusion's script. This typo can be the reason for the artifacts displayed in Fig. 12 of the paper "Variational Methods for Normal Integration" (paper A hereafter).

In line 70 of anisotropic diffusion's script, nine terms are added to compute A: https://github.com/yqueau/normal_integration/blob/00d1a4c0f8e6e7c21b5b8239d95ac2e72d57514d/Toolbox/anisotropic_diffusion_integration.m#L70 I think the A here is from the normal equation of Eq. (89) in paper A.

The last two terms are written as (Dum'*(Amm_mat.^2)*Dup)+(Dvm'*(Bmm_mat.^2)*Dvp). I was wondering should the two terms be (Dum'*(Amm_mat.^2)*Dum)+(Dvm'*(Bmm_mat.^2)*Dvm)?

I did a comparison on the vase object between the two choices, following the parameter setting of Fig. 12 of paper A; the results are shown as below. The top is from the original implementation, and the bottom is from my modification. It can be seen after the modification, the artifacts around the discontinuities are gone.

vase_typo vase_correct

BTW, I also tested the modified code on the tent object (mu=0.08, max_iter=300), the result looks good. tent

I just want to share this interesting finding :) It implies Mumford-Shah integrator might not be the best one for discontinuity preserving normal integration among existing methods.

Best

yqueau commented 2 years ago

Hello !

Thank you A LOT for spotting this out ! I could not figure where these artefacts were coming from, for so many years now :D . I fixed according to your suggestion, now indeed anisotropic diffusion seems to be a much more reasonable choice for integrating with discontinuities ! Again, big thanks !

Yvain