Closed canghaiyunfan closed 2 years ago
Use render_mesh function https://github.com/namepllet/HandOccNet/blob/65c00af06ad81f568a6ad0ff4919f7f1d6c65e44/common/utils/vis.py#L123 to visualize mesh on the image.
@namepllet I tried to visualize mesh with this function, but the results is not correct. Can you add a example to demo?
Do you like to visualize mesh for arbitrary images ?
Our model predicts root-relative 3D coordinates of joints and vertices.
So we can visualize mesh on image when 3D camera coordinate of root and camera parameters are available.
@namepllet yes, I want to visualize mesh for arbitrary images. I get camera parameter with the code
`def compute_scale(fov, width, height): wh = max(width, height) / 2 angle = fov / 2 len1 = np.sin(angle/180np.pi) len2 = np.cos(angle/180np.pi) scale = len2/len1*wh return scale
f = compute_scale(60, ori_img_width, ori_img_height) K = np.array([[f, 0, input_model_width/2], [0, f, input_model_height/2], [0, 0, 1]])`
When training, we didn't apply 2D projection loss using virtual camera parameters.
Your code assumes 60 degree fov and principal point at center of image. It may not works for projection.
Furthermore 3D camera coordinate of root joint is also needed.
If 3D camera coordinate of root and camera parameters are not available which are not inferred by our model, we cannot render mesh on image.
@namepllet Got it. Thanks.
Thanks for your great work!
how to visualize mesh on the image?