How to get information about whether bone points are blocked

I use the following code to get the bone points of the left hand and map them to the 2D image:
for bone in armature.bones:
if ‘LeftHand’ in bone.name:
hand_point = np.array(bone.head)
hand_point = np.r_[hand_point,[1]]
hand_point = final_matrix @ hand_point
P = Vector((hand_point[0], hand_point[1], hand_point[2]))
proj_p = project_3d_point(camera=camera, p=P, render=render)
cv2.circle(img, proj_p…
cv2.imwrite(…)

But sometimes the key points of the left hand are blocked by the human body.

My question is, how can I get the status of whether each key point is blocked?
Thanks

here is the normal result:

And in this png, hand is blocked by body, how can I get the blocked status of each key point?

Perhaps a ray cast from the camera origin to the points could be used:
https://docs.blender.org/api/current/bpy.types.Scene.html#bpy.types.Scene.ray_cast