You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to see 2D keypoints of certain frame on images so i did projection processing.
but i got wrong result. what's the matter??
As i know about getting 2D points is {2D keypoints = homogeneous(projection matrix * 3D keypoints)}
Could you tell me what's the problem...??
More details about my code:
i want to see image0000000.jpg & projected 2D keypoints each frame.
import torch
import numpy as np
from lib.models.smpl import SMPL
import os
import pdb
sub_path = '/Body_1_80_updat/subject_1/body/'
frames = os.listdir(sub_path)[:-4]
proj = open(sub_path+'project.txt','r').readlines()
projection = np.zeros((107,3,4))
extrinsic = np.zeros((107,3,4))
intrinsic = np.zeros((107,3,3))
cam_KR = np.zeros((107,3,4))
for i in range(len(projection)):
projection[i,0] = np.array(proj[4+4*i].split(),dtype=np.float32)
projection[i, 1] = np.array(proj[5 + 4*i].split(),dtype=np.float32)
projection[i, 2] = np.array(proj[6 + 4*i].split(),dtype=np.float32)
import cv2
imglist = list(range(107))
for frame in frames:
img_path = '/Body_1_80_updat/subject_1/body/%s/image/'%frame
img_list = os.listdir(img_path)
keypoints_path ='/Body_1_80_updat/subject_1/body/%s/reconstruction/keypoints.txt'%frame
keypoints_3d= np.loadtxt(keypoints_path).reshape(-1,3)
dummy = np.ones((len(keypoints_3d), 1))
kpts = np.concatenate((keypoints_3d, dummy), axis=1)
kpts = np.matmul(kpts, projection[0].T)
kpts = kpts[:,:2]/kpts[:,2].reshape(-1,1)
img = cv2.imread(img_path+img_list[0])
for joint in kpts:
cv2.circle(img, (int(joint[0]),int(joint[1])),10,(255,0,0),-1)
img = cv2.resize(img, (512,512))
cv2.imshow('img', img)
k = cv2.waitKey()
if k == 27:
cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered:
I want to see 2D keypoints of certain frame on images so i did projection processing.
but i got wrong result. what's the matter??
As i know about getting 2D points is {2D keypoints = homogeneous(projection matrix * 3D keypoints)}
Could you tell me what's the problem...??
More details about my code:
i want to see image0000000.jpg & projected 2D keypoints each frame.
The text was updated successfully, but these errors were encountered: