Bläddra i källkod

Merge pull request #8 from languitar/multires-improvements

Multires python script improvements
pull/12/head
Matthew Petroff 10 år sedan
förälder
incheckning
6a53f7436b
1 ändrade filer med 14 tillägg och 5 borttagningar
  1. +14
    -5
      utils/multires/generate.py

+ 14
- 5
utils/multires/generate.py Visa fil

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Requires Python 3.2+

@@ -27,17 +27,26 @@ import argparse
from PIL import Image
import os
import math
from distutils.spawn import find_executable
import subprocess

# find external programs
nona = find_executable('nona')

# Parse input
parser = argparse.ArgumentParser(description='Generate a Pannellum multires tile set from an equirectangular panorama.')
parser = argparse.ArgumentParser(description='Generate a Pannellum multires tile set from an equirectangular panorama.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('inputFile', metavar='INPUT',
help='full equirectangular panorama to be processed')
parser.add_argument('-o', '--output', dest='output', default='./output',
help='output directory (default: ./output)')
help='output directory')
parser.add_argument('-s', '--tilesize', dest='tileSize', default=512, type=int,
help='tile size in pixels (default: 512)')
help='tile size in pixels')
parser.add_argument('--png', action='store_true',
help='output PNG tiles instead of JPEG tiles')
parser.add_argument('-n', '--nona', default=nona, required=nona is None,
metavar='EXECUTABLE',
help='location of the nona executable to use')
args = parser.parse_args()

# Create output directory
@@ -75,7 +84,7 @@ with open(os.path.join(args.output, 'cubic.pto'), 'w') as f:

# Create cube faces
print('Generating cube faces...')
os.system('nona -o ' + os.path.join(args.output, 'face') + ' ' + os.path.join(args.output, 'cubic.pto'))
subprocess.check_call([args.nona, '-o', os.path.join(args.output, 'face'), os.path.join(args.output, 'cubic.pto')])
faces = ['face0000.tif', 'face0001.tif', 'face0002.tif', 'face0003.tif', 'face0004.tif', 'face0005.tif']

# Generate tiles


Laddar…
Avbryt
Spara