【问题标题】:How to detect eye pupils and measure distance between pupils in iPhone如何在iPhone中检测眼睛瞳孔并测量瞳孔之间的距离
【发布时间】:2012-09-01 02:32:06
【问题描述】:

我研究了很多关于面部检测的示例,并且我使用CIDetectorHaarCascade_eye.xml 在 iPhone 中检测到了眼睛。但我想检测眼睛的瞳孔并想测量瞳孔之间的距离。请指导我一些事情,以便我可以做到这一点。

【问题讨论】:

  • 我前段时间通过 HUE 颜色空间检测到了瞳孔。眼睛的白色区域的饱和度非常低。但我使用的是桌面系统,光线很好。
  • ..你在这方面有什么进展吗?如果是的话,如果你分享我将不胜感激,谢谢
  • 不,我没有找到任何特定的解决方案。所以我取消了这个项目。

标签: ios core-image face-detection


【解决方案1】:

使用以下公式计算两点之间的距离:

这将获取两只眼睛的中心点(由 CIDetector 检测到)并比较它们的位置以输出您正在寻找的测量值。

if(faceFeature.hasLeftEyePosition && faceFeature.hasRightEyePosition)
{
    CGPoint leftEyeCenter = faceFeature.leftEyePosition;
    CGPoint rightEyeCenter = faceFeature.rightEyePosition;

    float simpleDistance = rightEyeCenter.x - leftEyeCenter.x;
    //This finds the distance simply by comparing the x coordinates of the two pupils

    float complexDistance = fabsf(sqrtf(powf(leftEyeCenter.y - rightEyeCenter.y, 2) + powf(rightEyeCenter.x - leftEyeCenter.x, 2)));
    //This will return the diagonal distance between the two pupils allowing for greater distance if the pupils are not perfectly level.       
}

【讨论】:

  • 听起来他也想找学生
  • @ColeJohnson 他的帖子似乎暗示他已经有了,他说他使用 CIDetector 来检测眼睛,在这种情况下是瞳孔。 CIDetector 从检测点的中心返回 CGPoints。
  • @NSPostWhenIdle 感谢您的回复。我已经检测到眼睛,但眼睛的中心与瞳孔的中心不完全匹配,所以我想检测眼睛的瞳孔。可能是通过检测瞳孔的边缘或类似的东西。这样我就可以正确检测瞳孔和瞳孔中心之间的距离。
  • @Dhariwal_Kuldeep 你得到答案了吗?我也陷入了同样的境地。
猜你喜欢
  • 2018-10-04
  • 2011-05-29
  • 1970-01-01
  • 2018-11-19
  • 1970-01-01
  • 2013-04-04
  • 2017-05-19
  • 2023-04-08
  • 1970-01-01
相关资源
最近更新 更多