I'm a beginner in image processing. I want to detect eye movement from webcam using openCV in python. I'm using this code snippet for the detection of right eye:
eye_cascade = cv2.CascadeClassifier('haarcascade_righteye_2splits.xml')
eyes = eye_cascade.detectMultiScale(gray, minSize=(30, 30))
for (ex, ey, ew, eh) in eyes:
cv2.rectangle(frame, (ex, ey), (ex+ew, ey+eh), (0, 255, 0), 2)
print(str(ex)+'b'+str(ey))
print("Sent\n")
It displays the pixels of my right eye in real time, like this:
.
.
.
260b216
Sent
261b219
Sent
.
.
.
I can see the pixel values change when I move my eyes, but I want python to calculate the distance between two consecutive pixel values: sqrt((261-260)^2 + (219-216)^2), and display this value as output, in real time. Which numpy/math/other functions do I have to use to achieve this?