Closed alsehaimaa closed 3 years ago
hi how can I extract 2d poses from the resulted 3d pose (2d pose front view, back view, and side view) thanks
You can project the 3D pose to 2D with your camera parameters. Use different extrinsic rotation/translation for different views. Method in this repo that can be used is: https://github.com/Nicholasli1995/EvoSkeleton/blob/b2b355f4c1fa842709f100d931189ce80008f6ef/libs/dataset/h36m/cameras.py#L8
thanks for your replay, i am trying to do it for my own images where i do not have such information is there any default value for it. Thanks in advance
thanks for your replay, i am trying to do it for my own images where i do not have such information is there any default value for it. Thanks in advance
You do not need many parameters to simulate a pin-hole camera. Assume you have 3d pose [x, y, z] in the camera coordinate system (this repo contains it) and you can project it to the screen as [fx/z, fy/z] where f is your focal length. I would suggest you take a look at camera models. See https://docs.opencv.org/4.5.3/d9/d0c/group__calib3d.html for example.
Thanks for your replay I am trying to use it for my own images i generate the pose using h36mpose.py and then run the inference but can i ask how to generate the stats.npy file ?
Thanks for your replay I am trying to use it for my own images i generate the pose using h36mpose.py and then run the inference but can i ask how to generate the stats.npy file ?
Use this inference script [https://github.com/Nicholasli1995/EvoSkeleton/blob/master/examples/inference.py](). Download the file following the instruction here [https://github.com/Nicholasli1995/EvoSkeleton/blob/master/docs/TRAINING.md]().
thanks so much for your replay I follow the instructions I just have trouble showing the 2d projection from 3d pose as follows
:
How can I visualize it right so I can see how accurate the projected 2d poses?
Thanks for everything, the code and support.
i try to use the following code but yet did not get it
`def project_to_cameras(poses): """ Project 3d poses using camera parameters input: 3D poses: [n_pose, pose length] cams: list of camera parameters return: list of 2D projections for each camera cams: """ p_2d = [] rcams= np.load('/Pose_for_Re-id/EvoSkeleton_master/cameras.npy', allow_pickle=True).item()
cams = add_virtual_cams(rcams)
#print('after adding')
# By default, all actions are used
ncams=4
for cam in range(ncams):
R, T, f, c, k, p, name = cams[(1, cam+1)]
pts2d, _, _, _, _ = cameras.project_point_radial(np.reshape(poses, [-1, 3]), R, T, f, c, k, p )
f = plt.figure(figsize=(9, 9))
ax4 = plt.subplot(131)
plt.title('2D key-point inputs: {:d}*2'.format(16))
ax4.set_aspect('equal')
ax4.invert_yaxis()
skeleton_pred = None
s2d=pts2d
show2Dpose(np.reshape( pts2d, [-1, len(H36M_NAMES)*2]),ax4)
p_2d.append(np.reshape( pts2d, [-1, len(H36M_NAMES)*2]))
return p_2d`
the results was :
If I need to rotate around the y-axis what should I change?
If I need to rotate around the y-axis what should I change?
See ax.set_xlim/set_ylim to control your 2D plot. Change R and T to the camera pose that you need.
Thanks but wen i change the anagle in add_virtual_cams to:
new_R, new_T = get_new_camera(R.T, T, [0.,angle, 0.])
nothing changed.
Thanks but wen i change the anagle in add_virtual_cams to:
new_R, new_T = get_new_camera(R.T, T, [0.,angle, 0.])
nothing changed.
You do not understand the code and coordinate transformation and I don't have time for beginner tutorial. Why not you upload your 3D pose and I simply write you a script to run? You can create a page in the discussion and I'm closing this issue since it's not a bug.
hi how can I extract 2d poses from the resulted 3d pose (2d pose front view, back view, and side view) thanks