示例#1
0
def alignScan(maskBaseVerts, maskScanVerts, scanVerts):
    """
    """

    aligned_verts, aligned_mask = scan_fit.align_scan(maskScanVerts,maskBaseVerts,scanVerts)

    for i,v in enumerate(aligned_verts):
        scanVerts[i][0] = v[0]
        scanVerts[i][1] = v[1]
        scanVerts[i][2] = v[2]

    for i,v in enumerate(aligned_mask):
        maskScanVerts[i][0] = v[0]
        maskScanVerts[i][1] = v[1]
        maskScanVerts[i][2] = v[2]
示例#2
0
def scan2meshFit(head_mesh,head_mask,scan_mesh,scan_mask,fit_verts,prefix,output,regul = 0.005):

    head_mesh = wf.read_obj(head_mesh)
    head_mask = wf.read_obj(head_mask)
    scan_mask = wf.read_obj(scan_mask)
    scan_mesh = wf.read_obj(scan_mesh)

    scan_mesh.vertices,scan_mask.vertices = scan_fit.align_scan(scan_mask.vertices,head_mask.vertices,scan_mesh.vertices)
    scan_mesh.save("aligned.obj")
    
    base_mask = scan_fit.TargetBase(prefix = prefix+"_mask")
    coefs = scan_fit.fit_mask(head_mesh.vertices,head_mask.vertices,scan_mesh.vertices,scan_mask.vertices,base_mask,constrained = True, regul = 0.005)

    base = scan_fit.TargetBase(prefix = prefix)

    target = scan_fit.fit_mesh(head_mesh.vertices,scan_mesh.vertices,base,fit_verts,init_coefs = coefs,niter = 1)

    head_mesh.vertices+=target
    head_mesh.save(output.replace(".target",".obj"))

    scan_fit.save_target(output,dict(zip(base.vert_list,target[base.vert_list])))