def visibilityTest(dpt, loc, tol=2.):
"""
z-buffer like visibility test for non-occluded joints
:param dpt: depth image
:param loc: 2D joint locations
:param tol: tolerance
:return: list of indices of visible ie non-occluded joints
"""
vis = []
for i in range(loc.shape[0]):
y = np.rint(loc[i, 1]).astype(int)
x = np.rint(loc[i, 0]).astype(int)
if 0 <= x < dpt.shape[1] and 0 <= y < dpt.shape[0]:
if np.fabs(dpt[y, x] - loc[i, 2]) < tol:
vis.append(i)
# else:
# print("joint {}: dpt {} anno {}".format(i, dpt[y, x], gtcrop[i, 2]))
return vis
评论列表
文章目录