NaughtyZZ / 3D_face_dense_registration

Towards Fine-Grained Optimal 3D Face Dense Registration: An Iterative Dividing and Diffusing Method (IJCV2023)
https://github.com/NaughtyZZ/3D_face_dense_registration/tree/main
52 stars 4 forks source link

How is the weights.txt generated? (For c++ "from scratch" version) #7

Closed LPHFAQ closed 5 months ago

LPHFAQ commented 6 months ago

Hello! I just succeeded in running the [VC++(from scratch)], now I want to try my own scanning face mesh data with your excellent work. But I'm confused about how the weights.txt is generated. Could you please tell me how to get this weithts txt file? It seems that there is some kind of operation on geodesic distance to generate the weights.

NaughtyZZ commented 6 months ago

It is an array sized NX30, where N is the number of vertices and 30 is the number of landmarks. Each element is inversely proportional to the squared distance between each landmark and each vertex.

You can also refer to the matlab version (demo_dense_registration.m Line 79-94 ), where Dfield.mat is a matrix of which each element is the geodesic distance from each point to each landmark on the template. I precompute it using a heat-flow based method [Crane et al. ACM TOG 2013. Geodesics in heat: A new approach to computing distance based on heat flow]. Other method for the computation of geodesic distance is OK. It only requires to be computed once only on the template.

LPHFAQ commented 6 months ago

It is an array sized NX30, where N is the number of vertices and 30 is the number of landmarks. Each element is inversely proportional to the squared distance between each landmark and each vertex.

You can also refer to the matlab version (_demo_denseregistration.m Line 79-94 ), where Dfield.mat is a matrix of which each element is the geodesic distance from each point to each landmark on the template. I precompute it using a heat-flow based method [Crane et al. ACM TOG 2013. Geodesics in heat: A new approach to computing distance based on heat flow]. Other method for the computation of geodesic distance is OK. It only requires to be computed once only on the template.

I find that the element in weights.txt equals to 1/(geodesic_distansce)^4, where the geodesic_distansce is the elements in Dfield.mat, is it right?

NaughtyZZ commented 6 months ago

I remember that it is right. You can test and verify it.

NaughtyZZ commented 6 months ago

There are also some tricks to avoid to denominator to be zero.

LPHFAQ commented 5 months ago

There are also some tricks to avoid to denominator to be zero.

Thanks for your reply! I still have another question. I find that the c++ library "libigl" can also compute geodesic distansce (function igl::exact_geodesic). So I try to use igl::exact_geodesic to compute geodesic distansce from all points to the 30 landmarks on your template.ply. But the computing results are different from that of "computeGeodesicTemplate.m" in your project. Shown as follows, P1 is your result, and P2 is my result using igl::exact_geodesic. image image Is there any difference between your method and libigl's method of computing geodesic distansce? By the way, I find some codes seem like post processing in computeGeodesicTemplate.m as the following figure: image Could please explain whether these codes have any specific meaning? I'm confused about what these codes mean.

NaughtyZZ commented 5 months ago
  1. Although the results are not the same, they are proportional to each other. I think that both of these codes are OK. The final value of geodistance is commonly affected by different algorithms and implementations. In my work, the geodistance is only required to be computed roughly rather than accurately.

  2. The former means to reverse the value, since the program computes the heat value rather than the geodesic distance. The latter is to correct the geodesic distances. Since the distance from A to B is the same to B to A, I get the average. Also, the geodistance from any points to themselves should be zero.

I hope that the above text can address you question. Thank you for you attention.

LPHFAQ commented 5 months ago
  1. Although the results are not the same, they are proportional to each other. I think that both of these codes are OK. The final value of geodistance is commonly affected by different algorithms and implementations. In my work, the geodistance is only required to be computed roughly rather than accurately.
  2. The former means to reverse the value, since the program computes the heat value rather than the geodesic distance. The latter is to correct the geodesic distances. Since the distance from A to B is the same to B to A, I get the average. Also, the geodistance from any points to themselves should be zero.

I hope that the above text can address you question. Thank you for you attention.

Hi! I tried to use the geodistance computed by libigl and I found the align result is the same with yours. I think your reply is just right! Thanks for your patient reply!