SeanChenxy / HandMesh

MIT License
344 stars 68 forks source link

test_images #23

Closed Yunnnnqiiiii closed 2 years ago

Yunnnnqiiiii commented 2 years ago

How do we prepare test images and get npy files?

SeanChenxy commented 2 years ago

Hi, we detect hand and crop the region of interest with 1.3x-larger box. As for npy file, we use it to save intrinsic camera parameters. You do not have to prepare npy file. Instead, you can estimate intrinsic camera parameters with an arbitrary FOV. For example,

def compute_scale(fov, width, height):
    wh = max(width, height) / 2
    angle = fov / 2
    len1 = np.sin(angle/180*np.pi)
    len2 = np.cos(angle/180*np.pi)
    scale = len2/len1*wh
    return scale

f = compute_scale(60, img_width, img_height)
K = np.array([[f, 0, frame_width/2], [0, f, frame_height/2], [0, 0, 1]])