hongsukchoi / TCMR_RELEASE

Official Pytorch implementation of "Beyond Static Features for Temporally Consistent 3D Human Pose and Shape from a Video", CVPR 2021
MIT License
274 stars 39 forks source link

Root joint location in pixel space? #9

Open luyr opened 2 years ago

luyr commented 2 years ago

Is there any way to output the root joint location in pixel space? THX!

hongsukchoi commented 2 years ago

Hi @luyr ,

Check out this code and codes around here.

Project the output meshes with the new scale and translation, then you will get the pixel location of root joint in the original image space.

Or check out below snippet to just catch the concept though it is assuming a perspective camera. (The current code in this repo assumes a weak perspective camera)

# bbox: (x_min, y_min, w, h)
# cfg.input_img_shape: (h, w)
root_cam = out['root_cam']
princpt = [bbox[0] + bbox[2] / 2, bbox[1] + bbox[3] / 2]
focal = [cfg.focal[0], cfg.focal[1]]
focal[0] = focal[0] * (bbox[2] / cfg.input_img_shape[1])
focal[1] = focal[1] * (bbox[3] / cfg.input_img_shape[0])