def main(geom_path, src, dist): if not os.path.exists(geom_path): print('%s not found' % geom_path) return if not os.path.exists(src): print('%s not found' % src) return geom = wrap.Geom(geom_path) triangles = load_json(src) points = [] shows = [] for triangle in triangles: wp = wrap.PointOnTriangle(*triangle) (x,y,z) = geom.pointOnTriangleToPoint(wp) points.append([round(x, 8), round(y, 8), round(z, 8)]) shows.append(wp) print(points) write_json(dist, points) wrap.selectPoints(geom, None, shows)
import ParseConfig reload(ParseConfig) print "Select config file" configFile = wrap.openFileDialog("Select config file", filter="Text Files (*.txt)") print "Config file is '%s'" % configFile tasks = ParseConfig.parseConfig(configFile, 'DefaultSettings_2_Wrapping.txt') 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)
import wrap # 1. Loading Basemesh print "Loading basemesh..." basemeshFileName = wrap.openFileDialog("Select Basemesh", filter="OBJ-file (*.obj)", dir=wrap.demoModelsPath) basemesh = wrap.Geom(basemeshFileName) print "OK" # 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 "Select config file" configFile = wrap.openFileDialog("Select config file", filter="Text Files (*.txt)") print "Config file is '%s'" % configFile tasks = ParseConfig.parseConfig(configFile) taskNum = 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[
# This example is created as answer for question of owen at # http://www.russian3dscanner.com/forum/index.php?topic=431.msg970#msg970 # # 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
print "Select config file" configFile = wrap.openFileDialog("Select config file", filter="Text Files (*.txt)") print "Config file is '%s'" % configFile tasks = ParseConfig.parseConfig(configFile) taskNum = 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['wrappedResultFileName']): print "Loading wrapped basemesh '%s'..." % task['wrappedResultFileName']