VIBE icon indicating copy to clipboard operation
VIBE copied to clipboard

SMPL translation parameters ?

Open anilkunchalaece opened this issue 4 years ago • 10 comments

Hi,

How can we calculate translation parameters ? The output file consist of pose , shape but I don't find any translation parameters.

anilkunchalaece avatar Jan 11 '21 08:01 anilkunchalaece

Hello @anilkunchalaece I've been analysing vibes pkl result file and for me, it seems that probably to add the translation, it would be nedded to join the camera movement with the hip bone pose.

You can see more about these parameters that are in the PKL file in this link

https://github.com/mkocabas/VIBE/blob/master/doc/demo.md#output-format

carlosedubarreto avatar Jan 11 '21 09:01 carlosedubarreto

Hi @carlosedubarreto Thanks for response. could you please explain bit more about it ? and provide references to it if any ? I guess I need to join orig_cam with hip bone pose joints2d / joints3d right ?

anilkunchalaece avatar Jan 11 '21 09:01 anilkunchalaece

Unfortunetely I can't explain more, because I wasnt able to test it. I just thought about it. I was also trying to make the body move, instead of being still, and the only way that came to mind was using both root bone (hip in this case, i guess) and the camera position. But I dont know how to use them together to make the final result of the body moving..

"I guess I need to join orig_cam with hip bone pose joints2d / joints3d right ?" Yeah, I think that is the way.

carlosedubarreto avatar Jan 11 '21 10:01 carlosedubarreto

From hmr - 60

    cam_s = cam[0]
    cam_pos = cam[1:]
    flength = 500.
    tz = flength / (0.5 * img_size * cam_s)
    trans = np.hstack([cam_pos, tz])

Are these what we are looking for ? Same also referenced here

anilkunchalaece avatar Jan 13 '21 14:01 anilkunchalaece

@carlosedubarreto I managed to get the body movin (great song), using orig_cam = output[1]['orig_cam'] from the pkl and computing perspective coordinates using the function you mentioned. (camera parameters in original image space (sx,sy,tx,ty) not the cropped one). My function:

img_size = 1280
flength = 500
outPutCoords = []
orig_cam = output[1]['orig_cam']

for cam in orig_cam:
    cam_s = cam[0:1]
    cam_pos = cam[2:]
    tz = flength / (0.5 * img_size * cam_s)
    trans = np.hstack([cam_pos, tz])
    outPutCoords.append(trans)

Then I rearranged to my coord system in WebGL. See here, with a special video I made to understand easily axis.

gifVibe You can't see a dirty draft here with bad synchro... http://whenistheweekend.com/webgl/vibeViz/gltf.html

nosy-b avatar Feb 11 '21 13:02 nosy-b

Really cool @nosy-b !!!!! I'll bookmark it for a test.

thanks a lot for sharing your discovery! 😍

carlosedubarreto avatar Feb 11 '21 14:02 carlosedubarreto

For classical intrinsic and extrinsic matrix, the following solution works well.

cam = dicts['orig_cam']
cam_s = cam[0:1]
cam_pos = cam[2:]
flength = w / 2.
tz = flength / (0.5 * w * cam_s)
trans = -np.hstack([cam_pos, tz])
camera_data['color_focal_length'].append(np.array([w / 2, w / 2]))
camera_data['color_center'].append(np.array([[w / 2, h / 2]]))
camera_data['c2w'].append(np.eye(4))
camera_data['c2w'][:3,3] = trans

tegusi avatar Aug 13 '21 02:08 tegusi

@carlosedubarreto I managed to get the body movin (great song), using orig_cam = output[1]['orig_cam'] from the pkl and computing perspective coordinates using the function you mentioned. (camera parameters in original image space (sx,sy,tx,ty) not the cropped one). My function:

img_size = 1280
flength = 500
outPutCoords = []
orig_cam = output[1]['orig_cam']

for cam in orig_cam:
    cam_s = cam[0:1]
    cam_pos = cam[2:]
    tz = flength / (0.5 * img_size * cam_s)
    trans = np.hstack([cam_pos, tz])
    outPutCoords.append(trans)

Then I rearranged to my coord system in WebGL. See here, with a special video I made to understand easily axis.

gifVibe gifVibe You can't see a dirty draft here with bad synchro... http://whenistheweekend.com/webgl/vibeViz/gltf.html

Hello. What do img_size and flength stand for? My image size is 1920*1080 and the focal length is 29mm, so what should be the img_size and flength?

surheaven avatar Aug 25 '22 08:08 surheaven

@anilkunchalaece did find a way to get 'trans' parametres for vibe_output.pkl ?

mayank64ce avatar Jan 11 '24 17:01 mayank64ce

@mayank64ce check this https://github.com/mkocabas/VIBE/issues/172#issuecomment-759501825

anilkunchalaece avatar Jan 11 '24 19:01 anilkunchalaece