Git Product home page Git Product logo

Comments (2)

geopavlakos avatar geopavlakos commented on August 20, 2024

You can follow the code in the forward_step to see how we calculate the 3D joints and project them to the image.
In what way were the 3D and 2D joints different from the ones you calculated?

from 4d-humans.

Marlod390 avatar Marlod390 commented on August 20, 2024

Thank for your reply. This is the code i use to visualize the first 25 predicted 2d joints on the original frame.
`import joblib
import cv2
import matplotlib.pyplot as plt
import numpy as np

data = joblib.load('/home/markusc/Videos/panda_test/video/output2/webvid/medium/3/4dhumans/3_4dhumans.pkl')

first_key = next(iter(data.keys()))
joints_2d_1 = data[first_key]['2d_joints'][0][:252]
joints_2d_2 = data[first_key]['2d_joints'][1][:25
2]

image_path = '/home/markusc/Videos/panda_test/video/3/json_files/multiple/3/0_pose.png'
image = cv2.imread(image_path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

img_height, img_width, _ = image.shape

joints_2d_1 = joints_2d_1.reshape(-1, 2)
joints_2d_2 = joints_2d_2.reshape(-1, 2)

joints_2d_1[:, 0] *= img_width
joints_2d_1[:, 1] *= img_height
joints_2d_2[:, 0] *= img_width
joints_2d_2[:, 1] *= img_height

print("Joints 2D 1 positions:")
print(joints_2d_1)

print("Joints 2D 2 positions:")
print(joints_2d_2)

plt.figure(figsize=(10, 10))
plt.imshow(image)

for idx, joint in enumerate(joints_2d_1):
if idx == 0:
plt.scatter(joint[0], joint[1], s=100, c='yellow', marker='o')
else:
plt.scatter(joint[0], joint[1], s=30, c='red', marker='o')
plt.text(joint[0], joint[1], str(idx), fontsize=12, color='red')

for idx, joint in enumerate(joints_2d_2):
if idx == 0:
plt.scatter(joint[0], joint[1], s=100, c='green', marker='o')
else:
plt.scatter(joint[0], joint[1], s=30, c='blue', marker='o')
plt.text(joint[0], joint[1], str(idx), fontsize=12, color='blue')

plt.title('2D Joints on Image - First Frame')
plt.axis('off')
plt.show()`

And the result is as follow
output

from 4d-humans.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.