Open Darius-H opened 1 year ago
I have small function for myself which does the conversion. Check if it helps.
Adjust certain values accordingly, such as Focal and img_res
def convert_weak_perspective_to_perspective(
weak_perspective_camera,
focal_length=5000.,
img_res=224,
):
# Convert Weak Perspective Camera [s, tx, ty] to camera translation [tx, ty, tz]
# in 3D given the bounding box size
# This camera translation can be used in a full-perspective projection
perspective_camera = np.stack(
[
weak_perspective_camera[1],
weak_perspective_camera[2],
2 * focal_length / (img_res * weak_perspective_camera[0] + 1e-9)
],
axis=-1
)
return perspective_camera
I'm trying to run https://github.com/open-mmlab/mmhuman3d/blob/main/demo/pymafx_estimate_smplx.py to get smplx params and perspective camera matrices. I tried to extract the weakperspective camera matrices R,T,K from the code here https://github.com/open-mmlab/mmhuman3d/blob/9431addec32f7fbeffa1786927a854c0ab79d9ea/mmhuman3d/core/visualization/visualize_smpl.py#L998C1-L1007C27 and covert them into perspective camera matrices. Those matrices works well, as I'm running the following code:
And output a good result like this:
Then I follow the tutorial here https://github.com/open-mmlab/mmhuman3d/blob/main/docs_zh-CN/cameras.md to change intrinsic matrix K to perspective camera, i write the following code:
However the output image is not well aligned:
Can you give me some advice to generate perspective camera matrices that can align with the image?