Track Eye Pupil Position with Webcam, OpenCV, and Python

前端 未结 2 1954
迷失自我
迷失自我 2021-02-15 17:21

I am trying to build a robot that I can control with basic eye movements. I am pointing a webcam at my face, and depending on the position of my pupil, the robot would move a ce

相关标签:
2条回答
  • 2021-02-15 17:43

    Just replace line where you created HoughCircles by this:

    circles = cv2.HoughCircles(roi_gray2,cv2.HOUGH_GRADIENT,1,200,param1=200,param2=1,minRadius=0,maxRadius=0)
    

    I just changed a couple of parameters and it gives me more accuracy.

    Detailed information about parameters here.

    0 讨论(0)
  • 2021-02-15 18:06

    I can see two alternatives, from some work that I did before:

    1. Train a Haar detector to detect the eyeball, using training images with the center of the pupil at the center and the width of the eyeball as width. I found this better than using Hough circles or just the original eye detector of OpenCV (the one used in your code).

    2. Use Dlib's face landmark points to estimate the eye region. Then use the contrast caused by the white and dark regions of the eyeball, together with contours, to estimate the center of the pupil. This produced much better results.

    0 讨论(0)
提交回复
热议问题