-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the result of output of head pose #10
Comments
I wonder the same, in the readme it states:
Some code can be found in def pose(frame, results, color):
landmarks, params = results
# rotate matrix
R = params[:3, :3].copy()
# decompose matrix to ruler angle
euler = rotationMatrixToEulerAngles(R)
print(f"Pitch: {euler[0]}; Yaw: {euler[1]}; Roll: {euler[2]};")
draw_projection(frame, R, landmarks, color) (ruler should be euler) The interesting thing is that And def draw_projection(frame, R, landmarks, color, thickness=2):
# build projection matrix
radius = np.max(np.max(landmarks, 0) - np.min(landmarks, 0)) // 2
projections = build_projection_matrix(radius)
# refine rotate matrix
rotate_matrix = R[:, :2]
rotate_matrix[:, 1] *= -1
# 3D -> 2D
center = np.mean(landmarks[:27], axis=0)
points = projections @ rotate_matrix + center
points = points.astype(np.int32)
# draw poly
cv2.polylines(frame, np.take(points, [
[0, 1], [1, 2], [2, 3], [3, 0],
[0, 4], [1, 5], [2, 6], [3, 7],
[4, 5], [5, 6], [6, 7], [7, 4]
], axis=0), False, color, thickness, cv2.LINE_AA) Then we can see that the center of where it draws is taken from the mean value of the landmarks and also it's 2d. Right now I'm trying to get it out. I will post more when I figured out more. |
One thing I just noted, also the radius is taken from the landmarks. If I visualise what I expect to be the translation data using For now I will check: headposeplus And maybe I come back if I find hacing the xyz into this one proves to be the best option. |
A splendid job! My work is about to make use of the head pose(R and T). So how to print the result.
The text was updated successfully, but these errors were encountered: