Last active
September 21, 2020 03:02
-
-
Save AdroitAnandAI/2003fe860c3a6184449e47945e776aa0 to your computer and use it in GitHub Desktop.
Euler to Cartesian Conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaw and pitch are important for mouse control | |
poseArrowX = orientation[0] #* arrowLength | |
poseArrowY = orientation[1] #* arrowLength | |
# Taking 2nd and 3rd row for 2D Projection | |
############################# LEFT EYE ################################### | |
cv2.arrowedLine(frame, leftEye_Center, | |
(int((xCenter_left + arrowLength * (cosR * cosY + sinY * sinP * sinR))), | |
int((yCenter_left + arrowLength * cosP * sinR))), (255, 0, 0), 4) | |
# center to top | |
cv2.arrowedLine(frame, leftEye_Center, | |
(int(((xCenter_left + arrowLength * (sinY * sinP * cosR - cosY * sinR)))), | |
int((yCenter_left + arrowLength * cosP * cosR))), (0, 0, 255), 4) | |
center to forward | |
cv2.arrowedLine(frame, leftEye_Center, \ | |
(int(((xCenter_left + arrowLength * sinY * cosP))), \ | |
int((yCenter_left - arrowLength * sinP))), (0, 255, 0), 4) | |
############################# RIGHT EYE ################################### | |
cv2.arrowedLine(frame, rightEye_Center, | |
(int((xCenter_right + arrowLength * (cosR * cosY + sinY * sinP * sinR))), | |
int((yCenter_right + arrowLength * cosP * sinR))), (255, 0, 0), 4) | |
# center to top | |
cv2.arrowedLine(frame, rightEye_Center, | |
(int(((xCenter_right + arrowLength * (sinY * sinP * cosR - cosY * sinR)))), | |
int((yCenter_right + arrowLength * cosP * cosR))), (0, 0, 255), 4) | |
center to forward | |
cv2.arrowedLine(frame, rightEye_Center, | |
(int(((xCenter_right + arrowLength * sinY * cosP))), | |
int((yCenter_right - arrowLength * sinP))), (0, 255, 0), 4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment