Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualizing projected 2D keypoints on the original image #27

Closed
ericwang0701 opened this issue Feb 12, 2021 · 4 comments
Closed

Visualizing projected 2D keypoints on the original image #27

ericwang0701 opened this issue Feb 12, 2021 · 4 comments

Comments

@ericwang0701
Copy link

Thank you for sharing your amazing work. I have tried to visualize the projected 2d keypoints (i.e. pj2d) on the original image.
Taking the 3dpw_sit_on_street.jpg sample image as an example. Since pj2d are normalized (-1~1) coordinates on the input image size (512x 512), I first compute their corresponding image coordinate in the original image size (1920x1080) by:
pj2d= (pj2d+ [1,1]) / 2 * [1920, 1080]

Then I plotted those keypoints on the original image. However, it seems there is an offset on the y-axis (i.e. height). All the keypoints are lower than the positions where they should be.
image

Any thoughts on how to compute and visualize projected 2D keypoints correctly would be really appreciated.

@Arthur151
Copy link
Owner

The bug could be easily fixed by replace
pj2d= (pj2d+ [1,1]) / 2 * [1920, 1080]
with
pj2d= (pj2d+ [1,1]) / 2 * [1920, 1920]

The reason is that the input image is a square.
Thanks for your interest! Best.

@dae-sun
Copy link

dae-sun commented Jun 2, 2021

Hello, I had same problem but I solved it.
here is solution code.

stride = max(H,W)
pj2d_results[batch_idx]= (pj2d_results[batch_idx]+1.0)/2*stride
j = pj2d_results[batch_idx][0]
img = cv2.circle(img,(int(j[0]),(int(j[1]-(W-H)/2))),10,(0,0,255),-1

@dae-sun
Copy link

dae-sun commented Jun 2, 2021

The bug could be easily fixed by replace
pj2d= (pj2d+ [1,1]) / 2 * [1920, 1080]
with
pj2d= (pj2d+ [1,1]) / 2 * [1920, 1920]

The reason is that the input image is a square.
Thanks for your interest! Best.

You should fix it!
thank you for your code.

@Arthur151
Copy link
Owner

Thanks for your contribution! I will fix it in the next commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants