isarandi / metrabs

Estimate absolute 3D human poses from RGB images.

Home Page:https://arxiv.org/abs/2007.07227

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bbox reprojection method “corner”

yunshangyue71 opened this issue · comments

if method in ('balanced', 'side_midpoints'):
old_side_midpoints = center + np.stack([-dx, -dy, dx, dy])
new_side_midpoints = cameralib.reproject_image_points(
old_side_midpoints, old_camera, new_camera)
new_midpoint_box = boxlib.bb_of_points(new_side_midpoints)

if method in ('balanced', 'corners'):
old_corners = center + np.stack([-dx - dy, dx - dy, dx + dy, -dx + dy])
new_corners = cameralib.reproject_image_points(
old_corners, old_camera, new_camera)
new_corner_box = boxlib.bb_of_points(new_corners)
center + np.stack([-dx - dy, dx - dy, dx + dy, -dx + dy]); i can't guess what you think?
center + np.stack([-dx - dy, dx - dy, dx + dy, -dx + dy]) ==>center + np.stack([-dx, -dy, dx, dy]) + np.stack([-dy, dx, dy, -dx])
is this an error? Is this what you really think?
center + np.stack([-dx, -dy, dx, dy]) + np.stack([-dy, -dx, dy, dx])==》 center + np.stack([-dx - dy, -dx - dy, dx + dy, dx + dy])

Perhaps the variables are named a bit confusingly.

Here dx and dy are both 2D vectors:

    dx = np.array([old_box[2] / 2, 0])
    dy = np.array([0, old_box[3] / 2])

So center + np.stack([-dx - dy, dx - dy, dx + dy, -dx + dy]) gives the corner points.

Big picture about this function: the idea is to take an axis-aligned 2D bounding box and reproject it into another axis-aligned bounding box for a new camera view. For this, two options are to either transform the four corner points and take their bounding box, or to transform the midpoints of the sides and take the bbox of those transformed points. Then the 'balanced' option takes the average of those two results.