Pto var
m |
(→Set image variables) |
||
Line 49: | Line 49: | ||
* '''--set a1=0,b1=-0.05,c1=0''' will set the lens distortion parameters for the second image. | * '''--set a1=0,b1=-0.05,c1=0''' will set the lens distortion parameters for the second image. | ||
− | + | You can also give an mathematical expression. Supported are: | |
− | * '''--set y1 | + | * the operators +-*/% and ^ (addition, subtraction, multiplication, division, modulo and exponentiation), |
− | * '''--set r2 | + | * parentheses, |
− | * '''--set v | + | * the functions ''abs, sin, cos, tan, asin, acos, atan, exp, ceil, floor'' and ''sqrt'' (trigonometric functions use the angle in radians), |
− | * '''--set Er | + | * the constant ''pi'' and the functions deg and rad to convert to degrees or radians, |
+ | * the constant ''i'' holds the image number, | ||
+ | * the constant ''val'' contains the old value, | ||
+ | * a if statement: ''x?y:z''. For the comparison statement you can use <, >, <=, >=, == (equal) and != (not equal) | ||
+ | The expression should return one return value. It may be necessary to quote the string to correctly get the special characters read. | ||
+ | |||
+ | See some examples: | ||
+ | * '''--set y1=val+10''' will increase yaw of the second image by 10 degrees. | ||
+ | * '''--set r2=val-90''' will decrease the roll angle of third image by 90 degrees. | ||
+ | * '''--set v=1.1*val''' will increase field of view for all images by 10 %. | ||
+ | * '''--set Er=val/1.1,Eb=val/1.2''' will divide the red multiplier by 1.1, and the blue multiplier by 1.2 respective for all images. | ||
+ | * '''--set y=i*90,p=-1^i*20,r=0''' a more complicated example for a fisheye panorama, sets yaw, pitch and roll | ||
+ | * '''--set "r=i<4?val+45:val"''' rotate the first 3 images by 45 degree individual (note: quoting for Windows) | ||
+ | |||
+ | You can also read the string from a text file. Use | ||
+ | pto_var --set-from-file filename --output=output.pto project.pto | ||
+ | In the text file the individual variables can be separated by comma or a line break. | ||
== General options == | == General options == |
Revision as of 18:52, 3 February 2013
Pto_var can manipulate image variables in Hugin .pto project files. The intended use of Pto_var is in Scripting. Pto_var can set image variables to a given value, it can change the link status and it can mark variables for optimisation.
The general use is:
pto_var [switches] --output=output.pto --opt|--link|--unlink|--set images input.pto
Optimisation variables
Pto_var can mark image variables for optimisation. (This information is stored in the v lines in the pto file.) This information is used by autooptimiser and vig_optimize to do the actual optimisation.
Running without other switches will only mark the variables given on the command line for optimisation. If you want to modify the marked variables add --modify-opt to the command line.
The usage is:
pto_var --opt "image variables list" input.pto
The image variable list consist of a comma separated list of image variables:
[!]name[image number]
The following image variables are allowed:
- position: y, p, r, TrX, TrY, TrZ
- lens parameters: v, a, b, c, d, e, g, t
- photometric parameters: EeV, Er, Eb, Vb, Vc, Vd, Vx, Vy, Ra, Rb, Rc, Rd, Re (Vignetting and response parameter will treated as group.)
The image numbers start with zero. If no number is given, the variables will be applied to all images. (In this case a special treatment applies to the position of the anchor image.)
An exclamation mark before the variable will remove the variable from the list of variables to optimised.
Examples:
- --opt y,p,r will optimize position for all images.
- --opt v,!v0 will optimize field of view for all images except the first.
- --opt Vb1,Ra1 will optimize vignetting and response curve for the second image.
- --modify-opt --opt !v will not optimize field of view.
Link or unlink image variables
To modify the link status of an image variable use --link or -unlink. Supply a list of comma separated image variables with corresponding image number.
Examples:
- --link v3 will link field of view of image 3.
- --link a1,b1,c1 will link lens distortion for second image.
- --unlink v0 will unlink field of view for the first image.
- --unlink Vb3,Ra3 will unlink vignetting and response curve for image 3.
Set image variables
With this switch you can set the image variable to the given value. This applies to all the image variables of that sort or only to a single image, when the image number is given.
Examples:
- --set y=0,p=0,r=0 will reset all image positions.
- --set a1=0,b1=-0.05,c1=0 will set the lens distortion parameters for the second image.
You can also give an mathematical expression. Supported are:
- the operators +-*/% and ^ (addition, subtraction, multiplication, division, modulo and exponentiation),
- parentheses,
- the functions abs, sin, cos, tan, asin, acos, atan, exp, ceil, floor and sqrt (trigonometric functions use the angle in radians),
- the constant pi and the functions deg and rad to convert to degrees or radians,
- the constant i holds the image number,
- the constant val contains the old value,
- a if statement: x?y:z. For the comparison statement you can use <, >, <=, >=, == (equal) and != (not equal)
The expression should return one return value. It may be necessary to quote the string to correctly get the special characters read.
See some examples:
- --set y1=val+10 will increase yaw of the second image by 10 degrees.
- --set r2=val-90 will decrease the roll angle of third image by 90 degrees.
- --set v=1.1*val will increase field of view for all images by 10 %.
- --set Er=val/1.1,Eb=val/1.2 will divide the red multiplier by 1.1, and the blue multiplier by 1.2 respective for all images.
- --set y=i*90,p=-1^i*20,r=0 a more complicated example for a fisheye panorama, sets yaw, pitch and roll
- --set "r=i<4?val+45:val" rotate the first 3 images by 45 degree individual (note: quoting for Windows)
You can also read the string from a text file. Use
pto_var --set-from-file filename --output=output.pto project.pto
In the text file the individual variables can be separated by comma or a line break.
General options
- -o|--output output.pto Output a pto file with the given filename. If not given it will append "_var" to the input filename.
- -h | --help Display help.