Transform
[TOC]
angle2matrix
1 | def angle2matrix(angles): |
angle2matrix_3ddfa
1 | def angle2matrix_3ddfa(angles): |
—————————————— 1. transform(transform, project, camera).
———- 3d-3d transform. Transform obj in world space
rotate
1 | def rotate(vertices, angles): |
normalize
1 | ## -------------- Camera. from world space to camera space |
lookat camera
1 | def lookat_camera(vertices, eye, at = None, up = None): |
orthographic_project 正交投影
1 | ## --------- 3d-2d project. from camera space to image plane |
perspective_project 透视投影
1 | def perspective_project(vertices, fovy, aspect_ratio = 1., near = 0.1, far = 1000.): |
to_image
1 | def to_image(vertices, h, w, is_perspective = False): |
estimate_affine_matrix_3d23d
1 | #### -------------------------------------------2. estimate transform matrix from correspondences. |
estimate_affine_matrix_3d22d
1 | def estimate_affine_matrix_3d22d(X, x): |
P2sRt
1 | def P2sRt(P): |
isRotationMatrix
1 | #Ref: https://www.learnopencv.com/rotation-matrix-to-euler-angles/ |
matrox2angle
1 | def matrix2angle(R): |