Esempio n. 1
0
tasksCount = len(tasks)
for taskNum, task in enumerate(tasks):

    print "Task %d of %d" % (taskNum + 1, tasksCount)
    print "Loading scan '%s'..." % task['scanFileName']
    scan = wrap.Geom(task['scanFileName'], fitToView=False)
    scan.wireframe = False
    scaleFactor = 100.0 / scan.boundingBoxSize[0]
    scan.scale(scaleFactor)
    wrap.fitToView()
    print "OK"

    if 'textureFileName' in task:
        print "Loading texture '%s'" % task['textureFileName']
        scan.texture = wrap.Image(task['textureFileName'])
        print "OK"
    else:
        print "No texture found"

    print "Loading basemesh '%s'..." % task['basemeshFileName']
    basemesh = wrap.Geom(task['basemeshFileName'], fitToView=False)
    print "OK"

    print "Rigid alignment..."
    basemeshPoints = wrap.loadPoints(task['basemeshPointsFileName'])
    scanPoints = wrap.loadPoints(task['scanPointsFileName'])
    transformMatrix = wrap.rigidAlignment(basemesh,
                                          basemeshPoints,
                                          scan,
                                          scanPoints,
# 2. Loading Scan
print "Loading scan..."
scanFileName = wrap.openFileDialog("Select Scan",
                                   filter="OBJ-file (*.obj)",
                                   dir=wrap.demoModelsPath)
scaleFactor = 1000
scan = wrap.Geom(scanFileName, scaleFactor=scaleFactor)
scan.wireframe = False
print "OK"

print "Loading texture..."
textureFileName = wrap.openFileDialog("Select Scan\'s Texture",
                                      filter="Image (*.jpg *.png *.bmp *.tga)",
                                      dir=wrap.demoModelsPath)
if textureFileName is not None:
    scan.texture = wrap.Image(textureFileName)
    scan.texture.show()
    print "OK"
else:
    print "No texture set"

print "Quick navigation: \n\tZoom: Scroll OR Alt + Right Click\n\tRotate: Alt + Left Click\n\tTranslate:Alt + Scroll Click"

# 3. Rigid Alignment: pick three points on the face to align the models
print "Rigid alignment... pick three points to match up on the models' faces"
(pointsScan, pointsBasemesh) = wrap.selectPoints(scan, basemesh)
rigidTransformation = wrap.rigidAlignment(basemesh,
                                          pointsBasemesh,
                                          scan,
                                          pointsScan,
                                          matchScale=True)
Esempio n. 3
0
while True:

    task = tasks[taskNum]

    print "Task %d of %d" % (taskNum + 1, len(tasks))
    print "Loading scan '%s'..." % task['scanFileName']
    scan = wrap.Geom(task['scanFileName'], fitToView=False)
    scan.wireframe = False
    scaleFactor = 100.0 / scan.boundingBoxSize[0]
    scan.scale(scaleFactor)
    wrap.fitToView()
    print "OK"

    if 'textureFileName' in task:
        print "Loading texture '%s'" % task['textureFileName']
        scan.texture = wrap.Image(task['textureFileName'])
        print "OK"
    else:
        print "No texture found"

    if os.path.exists(task['postprocResultFileName']):
        print "Loading wrapped basemesh '%s'..." % task[
            'postprocResultFileName']
        postprocResult = wrap.Geom(task['postprocResultFileName'],
                                   scaleFactor=scaleFactor,
                                   fitToView=False)
        postprocResult.wireframe = False
        print "OK"

        if 'postprocResultTextureFileName' in task and os.path.exists(
                task['postprocResultTextureFileName']):
Esempio n. 4
0
    if basemesh: del basemesh
    if scan: del scan
    wrap.fitToView()

    print "Task %d of %d" % (taskNum + 1, len(tasks))
    print "Loading scan '%s'..." % task['scanFileName']
    scan = wrap.Geom(task['scanFileName'], fitToView=False)
    scan.wireframe = False
    scaleFactor = 100.0 / scan.boundingBoxSize[0]
    scan.scale(scaleFactor)
    wrap.fitToView()
    print "OK"

    if 'textureFileName' in task:
        print "Loading texture '%s'" % task['textureFileName']
        scan.texture = wrap.Image(task['textureFileName'])
        print "OK"
    else:
        print "No texture found"

    print "Loading basemesh '%s'..." % task['basemeshFileName']
    basemesh = wrap.Geom(task['basemeshFileName'], fitToView=False)
    print "OK"

    if 'basemeshTextureFileName' in task:
        print "Loading basemesh texture '%s'" % task['basemeshTextureFileName']
        basemesh.texture = wrap.Image(task['basemeshTextureFileName'])
        print "OK"
    else:
        print "No basemesh texture found"
Esempio n. 5
0
# It shows usage of wrap.subset and wrap.applySubset commands while creating blendshapes
# When head scans are ideally aligned to each other by the skull,
# there is no need to use subset since there will be no unintended global movement of the head.
# But in the cases when you need absolute no movement of some vertices you can use subsets.
#
# In this particular case we restrict movement of the back of the head.
#
# Subsets can be used not only in blendshapes but also for other cases
# like wrapping a full-body base mesh (with legs, arms, torso, head) to just the frontal part of a face mesh.

basemesh = wrap.Geom(wrap.demoModelsPath +
                     "/AlexNeutral_3DHumanity_Wrapped.obj",
                     scaleFactor=1000)
basemesh.wireframe = False
basemesh.shaded = False
basemesh.texture = wrap.Image(wrap.demoModelsPath +
                              "/AlexNeutral_3DHumanity_Wrapped.jpg")

basemeshPoints = wrap.loadPoints("BasemeshPoints.txt")
basemeshControlPoints = wrap.loadPoints("BasemeshControlPoints.txt")

scanFileName = wrap.demoModelsPath + "/AlexSmile_3DHumanity.obj"
textureFileName = wrap.demoModelsPath + "/AlexSmile_3DHumanity.jpg"
scanPoints = wrap.loadPoints("AlexSmilePoints.txt")
scanControlPoints = wrap.loadPoints("AlexSmileControlPoints.txt")

print "Processing: ", scanFileName
scan = wrap.Geom(scanFileName, scaleFactor=1000)
scan.wireframe = False
scan.shaded = False
scan.texture = wrap.Image(textureFileName)