Closed foocker closed 2 years ago
Camera parameters project 3d points to 2d image coords. You can draw the projected 2d landmarks to check whether you are right.
Camera parameters project 3d points to 2d image coords. You can draw the projected 2d landmarks to check whether you are right. ··· k = 5 # 数据中第k个 camera = Camera() import scipy.io as sio from os.path import join data_root = './data/Obama2' scale = sio.loadmat(join(data_root, 'id_scale.mat'))['scale'][0,0] # 来自3D人脸追踪, 一个数
pred_headpose = np.zeros((10, 6), dtype=np.float32) # 这里测试3D->2D,没有旋转,没有平移
fit_data = np.load('./data/Obama2/3d_fit_data.npz') trans = fit_data['trans'][:,:,0].astype(np.float32) # (13369, 3) rot_angles = fit_data['rot_angles']
pred_headpose[k, 3:] = trans[k] pred_headpose[k, 0] += 180
final_pts3d = tracked3D_normalized_pts_fix_contour
predlandmarks, , _ = project_landmarks(camera_intrinsic, camera.relative_rotation, camera.relative_translation, scale, pred_headpose[k], final_pts3d[k]) print(pred_landmarks[k], 'gg', tracked2D_normalized_pts_fix_contour[k][k]) ··· from above code i can (equal at a small error), translate 3D(tracked3D_normalized_pts_fix_contour) to 2D(tracked2D_normalized_pts_fix_contour). but there are still a small gap. [and shoulder can also tranlate by the same way]
my question is:
in your paper, camera is at (0, 0, 0 ) and no rotation, so only camera intrinsic can do 3d -> 2d. but i have test the given file which in inference, i got the wrong result. my questuon is: camera_intrinsic,+change_paras, do tracked3D_normalized_pts_fix_contour->tracked2D_normalized_pts_fix_contour . how?
··· pts_3d = tracked3D_normalized_pts_fix_contour[0, 2, :] td = camera_intrinsic.dot((pts_3d+1)/2) td = td[:2] /td[-1] ···