def __init__(self, width, height): self.viewDist = 50 self.width = width self.height = height self.zNear = 1.0 self.zFar = 2000.0 self.xMousePosPrev = 0 self.yMousePosPrev = 0 self.xTrans = 0 self.yTrans = 0 self.zTrans = 400 self.xRot = 60 self.yRot = -40 self.zRot = 0 self.viewMode = 'free' self.frameId = 0 self.camId = deque('00', maxlen=2) self.coco25_parents = [ 1, 1, 1, 2, 3, 1, 5, 6, 1, 8, 9, 10, 8, 12, 13, 0, 0, 15, 16, 14, 19, 14, 11, 22, 11 ] self.adamWrapper = ADAM(pkl_path=adamPath) self.smplWrapper = SMPL(pkl_path=smplPath, joint_type='legacy') self.mouseAction = "" self.models = None self.modelsGhost = None self.meshs = None self.curcamid = 0
def __init__(self, width, height): self.viewDist = 50 self.width = width self.height = height self.zNear = 1.0 self.zFar = 2000.0 self.xMousePosPrev = 0 self.yMousePosPrev = 0 self.xTrans = 0 self.yTrans = 0 self.zTrans = 800 self.xRot = 60 self.yRot = -40 self.zRot = 0 self.viewMode = 'free' self.frameId = 0 self.camId = deque('00', maxlen=2) self.adamWrapper = ADAM(pkl_path=adamPath) self.smplWrapper = SMPL(pkl_path=smplPath, joint_type='legacy') self.mouseAction = "" self.models = None
def main_func(): aWrapper = ADAM(pkl_path='../../models/adamModel_lbs_200.pkl') with open('../../models/adamModel_lbs_200.pkl') as fio: adamModel = pickle.load(fio) model_file = '../../models/adam_v1_plus2.json' with open(model_file) as fio: modelStr = json.load(fio) coco_reg = modelStr['small_coco_reg'] coco_reg = np.array(coco_reg[1:]) coco_reg_sparse = scipy.sparse.coo_matrix( (coco_reg[:, 2], (coco_reg[:, 0], coco_reg[:, 1])), shape=(19, 18540)).tocsr() coco25_reg_sparse = scipy.sparse.csr_matrix((25, 18540)) coco25_coco19_remap = [ 14, 12, 8, 7, 6, 9, 10, 11, 13, 2, 1, 0, 3, 4, 5, 16, 15, 18, 17 ] coco25_reg_sparse[0:19, :] = coco_reg_sparse[coco25_coco19_remap, :] coco25_reg_sparse[ 8, :] = coco25_reg_sparse[12, :] * 0.5 + coco25_reg_sparse[9, :] * 0.5 coco25_reg_sparse[19, 12239] = 1.0 coco25_reg_sparse[20, 12289] = 1.0 coco25_reg_sparse[21, 12368] = 0.5 coco25_reg_sparse[21, 12357] = 0.5 coco25_reg_sparse[22, 14238] = 1.0 # coco25_reg_sparse[23, 14288] = 1.0 coco25_reg_sparse[24, 14357] = 0.5 coco25_reg_sparse[24, 14361] = 0.5 adamModel['J_regressor_coco25'] = coco25_reg_sparse adamModel['kintree_coco25'] = numpy.vstack((coco25_parents, coco25_ids)) print adamModel['J_regressor_coco25'] with open('../../models/adamModel_with_coco25_reg.pkl', 'wb') as fio: pickle.dump(adamModel, fio, protocol=pickle.HIGHEST_PROTOCOL)
import numpy as np import numpy.random import matplotlib.pyplot as plt import os.path import glob import json import time import cPickle as pickle import copy import sys sys.path.append('/home/xiul/workspace/PanopticDome/python') from domedb_utils.batch_adam import ADAM import mvg_utils.triangulate as DLTtriangulate adamWrapper = ADAM( pkl_path='../../models/adamModel_with_coco25_reg.pkl', reg_type='coco25') import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d def parse_calibs(calibFile, viewnodes): #P_Matrix as K*[R,t] 3x4 with open(calibFile) as f: calibs = json.load(f) cameras = calibs['cameras'] #cameras = rawCalibs['cameras'] allPanel = map(lambda x: x['panel'], cameras) hdCamIndices = [i for i, x in enumerate(allPanel) if x == 0] hdCams = [cameras[i] for i in hdCamIndices]
import numpy as np import numpy.linalg as nl import sys import os sys.path.append('/home/xiul/workspace/PanopticDome/python') from meshWrapper import meshWrapper from domedb_utils.batch_adam import ADAM from domedb_utils.batch_smpl import SMPL import copy import cPickle as pickle from opendr.geometry import VertNormals import sklearn.preprocessing import scipy.sparse rootpath = os.path.dirname(os.path.abspath(__file__)) adamPath = '/media/posefs3b/Users/xiu/PanopticDome/models/adamModel_lbs_200.pkl' adamWrapper = ADAM(pkl_path=adamPath, reg_type='legacy') smplPath = '/media/posefs3b/Users/xiu/PanopticDome/models/neutral_smpl_with_cocoplus_reg.pkl' smplWrapper = SMPL(pkl_path=smplPath, joint_type='cocoplus') coco_reg = smplWrapper.joint_regressor[0].T dome_to_angjoo = [ 14, 13, 12, 6, 7, 8, 11, 10, 9, 3, 4, 5, 0, 2, 1, 15, 17, 16, 18 ] corrsFile = '../../models/correspondences_nofeet.txt' corrsId = np.loadtxt(corrsFile) handsId = [] target_adam_v = None # #generateAdam_UVI_map() meshlib = meshWrapper( lib_file=os.path.join(rootpath, '../../build/libPythonWrapper.so'))
import threading import time import glob import os.path import copy import sklearn.preprocessing import cv2 sys.path.append('/home/xiul/workspace/PanopticDome/python') from domedb_utils.batch_adam import ADAM from domedb_utils.batch_smpl import SMPL smplPath = '/media/posefs3b/Users/xiu/PanopticDome/models/neutral_smpl_with_cocoplus_reg.pkl' adamPath = '/media/posefs3b/Users/xiu/PanopticDome/models/adamModel_lbs_200.pkl' adamWrapper = ADAM(pkl_path=adamPath) smplWrapper = SMPL(pkl_path=smplPath) g_args = None g_paramfiles = [] g_saveDir = None def InstanceSMPL(frame_id): print g_paramfiles[frame_id] trans = [] betas = [] poses = [] exps = []