示例#1
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 = 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 vis_dist():
    from domedb_utils.batch_smpl import SMPL
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import axes3d
    import matplotlib.colors as pltcolor
    import cPickle as pk
    with open('./dist.pkl') as fio:
        dist = pk.load(fio)
    print dist

    smpl = SMPL(pkl_path='../../models/basicmodel_m_lbs_10_207_0_v1.0.0.pkl',
                joint_type='legacy')
    v = smpl.v_template
    v = v * 100
    fig = plt.figure(figsize=(15, 15))
    ax = fig.add_subplot(111, projection='3d')

    X = v[:, 0]
    Y = v[:, 1]
    Z = v[:, 2]

    dist[dist > 5000] = 5000
    maxD = dist.max()
    minD = dist.min()

    dist = (dist - minD) / (maxD - minD)
    print dist

    ax.scatter(
        v[:, 0], v[:, 1], v[:, 2], s=5, c=dist, cmap='jet'
    )  #,norm=pltcolor.LogNorm(vmin=dist.min(),vmax=dist.max()),cmap='jet')
    max_range = np.array(
        [X.max() - X.min(),
         Y.max() - Y.min(),
         Z.max() - Z.min()]).max() / 2.0
    mid_x = (X.max() + X.min()) * 0.5
    mid_y = (Y.max() + Y.min()) * 0.5
    mid_z = (Z.max() + Z.min()) * 0.5
    ax.set_xlim(mid_x - max_range, mid_x + max_range)
    ax.set_ylim(mid_y - max_range, mid_y + max_range)
    ax.set_zlim(mid_z - max_range, mid_z + max_range)

    plt.show()
 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
示例#4
0
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'))
meshlib.load_totalmodel()
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 = []
    with open(g_paramfiles[frame_id]) as f:
from domedb_utils.batch_adam import ADAM
from domedb_utils.batch_smpl import SMPL

#DensePose and Adam Global Items
import scipy.io
smpldpPath = '/media/posefs3b/Users/xiu/PanopticDome/models/SMPL_DP.mat'
smpldpFile = scipy.io.loadmat(smpldpPath)
smpldp = smpldpFile['SMPL_IUV']
dp_colors = smpldp[:, [2, 1, 3]]
part_index = dp_colors[:, 2].astype(np.int)
dp_colors[:, 2] = dp_colors[:, 2] / 255.0
dp_colors = dp_colors[:, ::-1]
#dp_colors[:,2] = dp_colors[:,2]/255.0

smplWrapper = SMPL(
    pkl_path='../../models/basicmodel_m_lbs_10_207_0_v1.0.0.pkl',
    joint_type='legacy')
# Egl Rendering Global Items

g_Width = 1920
g_Height = 1080

znear = 0.01
zfar = 3000.

g_UVITexture = None
g_maskTexture = None

g_fbo_UVI = None
g_fbo_mask = None