Skip to content
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

Symmetry list #9

Open
yfji opened this issue Dec 4, 2020 · 1 comment
Open

Symmetry list #9

yfji opened this issue Dec 4, 2020 · 1 comment

Comments

@yfji
Copy link

yfji commented Dec 4, 2020

Hi! Thanks for your work! I want to known if the BFM2017 and BFM2019 provide the symmetry list of vertices like BFM2009?

@Andreas-Forster
Copy link
Member

Hi there,

I think the symmetry for the BFM2017 should be the same as for the BFM2009.

For the BFM2019 you can build it yourself, the reference should be mirrored at the z-y plane up to numerical inaccuracies. In scala you can use something similar to the following code to find a list of the point index pairs:

import java.io.File

import scalismo.utils.Random
import scalismo.faces.io.MoMoIO

object Symmetry extends App {
  scalismo.initialize()
  implicit val rng = Random(1024l)

  val momo = MoMoIO.read(new File("model2019.h5")).get

  val points = momo.referenceMesh.pointSet.points.toIndexedSeq
  val mirroredPoints = points.map(pt => pt.copy(x = -pt.x))
  val symmetryList = for ((pt, idx) <- points.zipWithIndex) yield {
    (idx, mirroredPoints.indexWhere(p => (p - pt).norm < 1.0e-4))
  }

  // check it for the first few points
  symmetryList.take(10).foreach(p => println(s" ${p._1}:${points(p._1)} ${p._2}:${points(p._2)}"))
}

Best, Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants