我可以使用ARKit 2获得眼睛的测量结果吗 [英] Can I get the measurements for eyes using ARKit 2

查看:244
本文介绍了我可以使用ARKit 2获得眼睛的测量结果吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个项目,该项目要求使用iPhone X上的ARKit和True depth摄像头以及Xcode 10 beta 4上的iOS 12 beta 4,使用每只眼睛的大小和两眼之间的距离.

I am working on a project which requires size of each eye and distance between the eyes using ARKit and True depth Camera on iPhone X with iOS 12 beta 4 on Xcode 10 beta 4.

由于我是ARKit的新手,所以我很少了解在线搜索解决方案.但是,我在苹果开发者门户网站上遇到了演示代码.在该代码中,我尝试获取所需的值.

As I am new to ARKit, I am searching the solution online with very little understanding. However, I came across a demo code on apple developer portal. In that code, I tried to fetch the required values.

也由@rickster引用了答案

我研究了ARSCNFaceGeometry和ARFaceAnchor来获取少量值.

I worked on ARSCNFaceGeometry and ARFaceAnchor to fetch few values.

func update(withFaceAnchor anchor: ARFaceAnchor) {
    let faceGeometry = geometry as! ARSCNFaceGeometry
    faceGeometry.update(from: anchor.geometry)
    print("\nLook at Point :", anchor.lookAtPoint, "\nLeft :", anchor.leftEyeTransform, "\nRight :", anchor.rightEyeTransform)
}

输出:

看点:float3(0.14502259,0.2905016,0.97809345)

Look at Point : float3(0.14502259, 0.2905016, 0.97809345)

左:simd_float4x4([[0.99312633,-0.030915117,-0.11289084,0.0)], [0.0,0.9644885,-0.26412484,0.0)],[0.11704737,0.26230934, 0.9578589、0.0)],[0.03311049、0.028666705、0.028539032、1.0)]])

Left : simd_float4x4([[0.99312633, -0.030915117, -0.11289084, 0.0)], [0.0, 0.9644885, -0.26412484, 0.0)], [0.11704737, 0.26230934, 0.9578589, 0.0)], [0.03311049, 0.028666705, 0.028539032, 1.0)]])

右:simd_float4x4([[0.9830616,-0.047965277,-0.17688738,0.0)], [0.0,0.96514606,-0.26171172,0.0)],[0.18327524,0.25727874, 0.94879806,0.0)],[-0.032072492,0.028482603,0.028181288,1.0)]])

Right : simd_float4x4([[0.9830616, -0.047965277, -0.17688738, 0.0)], [0.0, 0.96514606, -0.26171172, 0.0)], [0.18327524, 0.25727874, 0.94879806, 0.0)], [-0.032072492, 0.028482603, 0.028181288, 1.0)]])

问题

  1. 如何转换这些值以利用它并获得一些 坐标?

  1. How to translate these values to make use of it and get some coordinates?

此代码将帮助我实现每只眼睛的大小和距离 眼睛之间.如果没有,那我该怎么做才能得到测量结果?

Will this code help me to achieve the size of each eye and distance between the eyes. If no, then what can I do to get the measurements?

推荐答案

针对学生距离的一线解决方案:

One line solution for pupils distance:

simd_distance(faceAnchor.rightEyeTransform.columns.3, faceAnchor.leftEyeTransform.columns.3)

将其乘以100即可得到以厘米为单位的答案. 如上所述,没有一种简单的方法可以测量虹膜或瞳孔大小,因为您需要开发一种可以执行以下操作的算法:

Multiple it by 100 to get the answer in centimeters. As mentioned above there is no a simple way to measure iris or pupils size, for that you need to develop an algorithm that will do the following:

1)找到圆圈并过滤出描述虹膜的圆圈

1) finds circles and filters the one that describes an iris

2)使用ARKit计算像素到毫米的值,然后使用它计算光圈大小

2) use ARKit to calculate the pixel to millimeter value and use it to calculate the iris size

这篇关于我可以使用ARKit 2获得眼睛的测量结果吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆