Unverified Commit a588943e authored by Jinhyung Park's avatar Jinhyung Park Committed by GitHub
Browse files

[Fix] #448 Clamp 3D votes projections to image boundaries (#463)



* Clamp 2D Projection of 3D Votes to Image Boundaries

* 'lint'

* 'lint;

* lint
Co-authored-by: default avatarYezhen Cong <52420115+THU17cyz@users.noreply.github.com>
parent 2c29afa3
...@@ -196,6 +196,10 @@ class VoteFusion(nn.Module): ...@@ -196,6 +196,10 @@ class VoteFusion(nn.Module):
img_flatten /= 255. img_flatten /= 255.
# take the normalized pixel value as texture cue # take the normalized pixel value as texture cue
uv_rescaled[:, 0] = torch.clamp(uv_rescaled[:, 0].round(), 0,
img_shape[1] - 1)
uv_rescaled[:, 1] = torch.clamp(uv_rescaled[:, 1].round(), 0,
img_shape[0] - 1)
uv_flatten = uv_rescaled[:, 1].round() * \ uv_flatten = uv_rescaled[:, 1].round() * \
img_shape[1] + uv_rescaled[:, 0].round() img_shape[1] + uv_rescaled[:, 0].round()
uv_expanded = uv_flatten.unsqueeze(0).expand(3, -1).long() uv_expanded = uv_flatten.unsqueeze(0).expand(3, -1).long()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment