#############           Example Script                  ##########################
#                       for nona
#
# This document describes the script supported by the nona stitcher.
#
# Based on the PTStitcher documentation
#
#
# Only lines starting with 'p','o', i', 'm' or 'k' are read, 
# so you can add comments and info as you like by using 
# other line starting characters.  

# The stitcher script must contain:
# one 'p'-line describing the output image (eg Panorama)
# one 'o'-line for each input image
# one 'm'-line for global options
#
# 'p'-line options
# w1000        width in pixels
# h600         height in pixels
# f0           projection format,
#                  0 - rectilinear (for printing and viewing)
#                  1 - Cylindrical (for Printing and QTVR)
#                  2 - Equirectangular ( for Spherical panos), default
#                  3 - full-frame fisheye
# v360         horizontal field of view of panorama (default 360)
# nPICT        Panorama file format, one of:
#                  PNG           png-format, 8 & 16 bit supported
#                  TIFF          tiff-format, all tiff types supported (8,16,32 bit int, float, double)
#                  TIFF_m        tiff-format, multi-file, one image per file
#                                  alpha layer with non-feathered clip mask at image border
#                  TIFF_multilayer  tiff-format, multi-image-file, all files in one image
#                                  alpha layer with non-feathered clip mask at image border
#                                  This filetype is supported by The GIMP
#                  JPEG          Panoramic image in jpeg-format.
#               some more supported file formats (mostly only 8 bit support)
#                  PNM, PGM, BMP, SUN, VIFF
#                  
#              Special options for TIFF output:
#              n"TIFF c:NONE"              
#                  c - select TIFF compression, possible options: NONE, LZW, DEFLATE
#
#              Special options for TIFF_m and TIFF_multilayer output:
#              n"TIFF c:NONE r:CROP"
#                  c - TIFF compression, possible options NONE, LZW, DEFLATE
#                  r - output only used image area (cropped output). The crop offsets
#                      are stored in the POSITIONX and POSITONY tiff tags
#                  p1 - save coordinate images (useful for further programs, like vignetting correction)
#
#              Special options for JPEG output:
#              n"JPEG q95"
#                  q - jpeg quality
#                  
# E12.3        exposure value for final panorama
# R1           stitching mode: 0: normal LDR mode, 1: HDR mode
# T"UINT8"     bitdepth of output images, possible values are
#               UINT8  -  8 bit unsigned
#               UINT16 - 16 bit unsigned
#               FLOAT  - 32 bit floating point
#              By default the bit depth of the input images is use.
#
# S100,600,100,800   Selection(left,right,top,bottom), Only pixels inside the rectangle
#                    will be rendered. Images that do not contain pixels in this area
#                    are not rendered/created.
#
# k1           Image number of reference image for photometric correction
#
# P"100 12"    Parameters for tuning projection, number of parameters depends on projection
#
p w1000 h600 f0 v360 E12.3

# The 'i' lines describe input images (nona also accepts 'o' line image descriptions)
#
# f0           projection format,
#                  0 - rectilinear (normal lenses)
#                  1 - Panoramic (Scanning cameras like Noblex)
#                  2 - Circular fisheye
#                  3 - full-frame fisheye
#                  4 - PSphere, equirectangular
# v82          horizontal field of view of image (required)
# y0           yaw angle (required)
# p43          pitch angle (required)
# r0           roll angle (required)
# a,b,c        lens correction coefficients (optional)
#                  (see http://www.fh-furtwangen.de/~dersch/barrel/barrel.html)
# d,e          initial lens offset in pixels(defaults d0 e0, optional).
#                  Used to correct for offset from center of image
#                  d - horizontal offset,
#                  e - vertical offset
# g,t          initial lens shear.  Use to remove slight misalignment
#                  of the line scanner relative to the film transport
#                  g - horizontal shear
#                  t - vertical shear
#
# Eev          exposure of image in EV (exposure values)
# Er           white balance factor for red channel
# Eb           white balance factor for blue channel
#
# Vm           vignetting correction mode (default 0):
#                  0: no vignetting correction
#                  1: radial vignetting correction (see j,k,l,o options)
#                  2: flatfield vignetting correction (see p option)
#                  4: proportional correction: i_new = i / corr.
#                       This mode is recommended for use with linear data.
#                       If the input data is gamma corrected, try adding g2.2
#                       to the m line.
#
#                      default is additive correction: i_new = i + corr

#                    Both radial and flatfield correction can be combined with the
#                     proportional correction by adding 4.
#                 Examples: i1 - radial polynomial correction by addition.
#                                 The coefficients j,k,l,o must be specified.
#                           i5 - radial polynomial correction by division.
#                                 The coefficients j,k,l,o must be specified.
#                           i6 - flatfield correction by division.
#                                 The flatfield image should be specified with the p option
#
# Va,Vb,Vc,Vd  vignetting correction coefficients. (defaults: 1,0,0,0)
#               ( 0, 2, 4, 6 order polynomial coefficients):
#                corr = ( i + j*r^2 + k*r^4 + l*r^6), where r is the distance from the image center
#              The corrected pixel value is calculated with: i_new = i_old + corr
#              if additive correction is used (default)
#			   for proportional correction (h5): i_new = i_old / corr;
#
# Vx,Vy        radial vignetting correction offset in pixels (defaults Vx0 Vy0, optional).
#                 Used to correct for offset from center of image
#                  Vx - horizontal offset
#                  Vy - vertical offset
#
# Vf           filename of flatfield image.
#               For additive correction the image will be used as it is.
#               In the case of correction by division, the flatfield will be divided by
#               its mean value.
#
# Ra,Rb,Rc,Rd,Re EMoR photometric model parameters. (defaults: 0,0,0,0,0) 
#
# TrX,TrY,TrZ  mosaic mode translation offsets.
#
# S100,600,100,800   Selection(l,r,t,b), Only pixels inside the rectangle will be used for conversion.
#                       Original image size is used for all image parameters
#                       (e.g. field-of-view) refer to the original image.
#                       Selection can be outside image dimension.
#                       The selection will be circular for circular fisheye images, and
#                       rectangular for all other projection formats
#
# j0           stack number
#
# nName        file name of the input image.

i f2 r0   p0    y0     v183    a0 b-0.1 c0  S100,600,100,800 n"photo1.jpg"
i f2 r0   p0    y180   v183    a0 b-0.1 c0  S100,600,100,800 n"photo1.jpg"


# 'm'-line options
# ----------------
# Set mode for stitcher, not required
#
#
# g2.5         Set gamma value for internal computations (default 1.0)
#                  See <http://www.fh-furtwangen.de/~dersch/gamma/gamma.html>
#               This is especially useful in conjunction with the vignetting correction
#               by division
#
# i2           Set interpolator, See <http://www.fh-furtwangen.de/~dersch/interpolator/interpolator.html>
#                one of:
#                   0 - poly3 (default)
#                   1 - spline16,
#                   2 - spline36,
#                   3 - sinc256,
#                   4 - spline64,
#                   5 - bilinear,
#                   6 - nearest neighbor,
#                   7 - sinc1024
#                   
m i2


# 'v'-line options
# ----------------
# Indicate i-line parameters to optimise
# nona ignores all 'v' lines, these lines are used by autooptimiser
# (a,b,c,d,e,v,r,p,y geometric parameters) and vig_optimize
# (Eev,Er,Eb,Va,Vb,Vc,Vd,Vx,Vy,Ra,Rb,Rc,Rd,Re photometric parameters)
#
# The format is described in libpano13 Optimize.txt


# 'k'-line options
# ----------------
# Optional image masks are described by a 'k' line
#
#  i2           Set image number this mask applies to
#
#  t0           Type for mask:
#                   0 - negative (exclude region)
#                   1 - positive (include region)
#                   2 - negative, stack aware (exclude region from stack)
#                   3 - positive, stack aware (include region from stack)
#                   4 - negative, lens (exclude region from all images of same lens)
#
#  p"1262 2159 1402 2065 1468 2003"  List of node coordinates
#               Coordinates are in pairs, at least three pairs are required

k i2 t0 p"1262 2159 1402 2065 1468 2003"


# 'c'-lines
# ----------------
# Control point lines
# nona ignores all 'c' lines, these lines are used by autooptimiser
#
# The format is described in libpano13 Optimize.txt
