google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.95k stars 1.22k forks source link

Measurement between two vertex on face points #995

Closed areyyaarr closed 3 years ago

areyyaarr commented 4 years ago

Hello Devs,

This is not an issue my a question as I didn't find any answer on internet. Question: Imagine I want to calculate the distance between eyes (which is also called Pupillary distance). Does the Augmented Face's face mesh gives accurate measurement (in any units) for all types of faces? How accurate it is? Is it just a normalized value of overall face?

More info below: image

AttilioDG commented 4 years ago

I have the same problem any news about?

hussamDana92 commented 4 years ago

I have the same problem

agGitHub commented 3 years ago

Interested! Any news?

devbridie commented 3 years ago

I'm working towards updating our public documentation for this; here's a quick precursor:

In this explanation, I'll be using Blender, but you could do something similar with other 3D software.

  1. Download canonical_face_mesh.fbx.
  2. Import the file in Blender using File > import > fbx.
  3. Follow this SO answer to enable vertex indices display.
  4. Selecting the face object, hop into Edit Mode (Tab) and select the vertices of interest (or all of them with a) to get something like this:
  5. For example, let's say I'm interested in the position of the face's tip of the nose. This is vertex 4. Use getMeshVertices to get the position of vertices on the face. Then use:
    val meshVerticesBuffer = face.getMeshVertices();
    val (x,y,z) = Triple(meshVerticesBuffer.get(4*3), meshVerticesBuffer.get(4*3+1),meshVerticesBuffer.get(4*3+2))  

    to determine the location of the top of the nose on the face (keep in mind that this position is relative to [the center pose of the face](https://developers.google.com/ar/reference/java/com/google/ar/core/AugmentedFace#getCenterPose())).

manukyanvaheV commented 3 years ago

@devbridie this is for getting xyz for certain point, but if I want to measure the distance between two points, I get x1, y1, z1 for point1 and x2, y2, z2 for point2, and when I do simple math to measure the distance it is inaccurate, and does not change depended on face.