Hi!
I tried decimation demo, it works fine! Now I want to decimate bunch of scans from directory. How can I do it?
By the way, how to interrupt script while executing?
Hi!
I tried decimation demo, it works fine! Now I want to decimate bunch of scans from directory. How can I do it?
By the way, how to interrupt script while executing?
Hi Ned!
All you need is to write simple cycle for iterating filenames in directory. I’ve made a simple script for you which does the task.
It will decimate selected scans and save them in the same directory add “_decimated.obj” to filenames
import wrap
fileNames = wrap.openFilesDialog(“Select input files”) # it shows window for file selection and puts list of files in filenames
print fileNames
nDecimatedPolygons = 50000 # number of polygons in decimated scans
for fileName in fileNames: # iterating over filenames
print "Decimating ", fileName
scan = wrap.Geom(fileName) # load scan
scan.hide() # don’t show scan anymore
# uncomment next line if you want do get 10% percent polygons of original scan instead of fixed 50000
#nDecimatedPolygons = int(scan.nPolygons * 0.1)
decimatedScan = wrap.decimate(scan, nDecimatedPolygons) # decimate scan
decimatedFileName = fileName + "_result.obj" # compose resulting filename
decimatedScan.save(decimatedFileName)
print "Decimated scan saved to ", decimatedFileName
Here you can see the result of decimating three scans from one and half of million polygons to 50000.
Notice that to preserve texture coordinates there are some stitches - polygons on border texture regions are untouched.
http://www.russian3dscanner.com/wp-content/uploads/decimate6.jpg