1 // Copyright 2002, 2003, 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #define BETWEEN_SECTIONS "\n"
26 #define HEADER_SPACE ""
32 const char *invocation
;
38 * This function produces a line of stars for banner output.
40 void stars(unsigned int n
) {
41 for (unsigned int i
= 0; i
< n
; i
++) {
42 fprintf(help_stream
, "*");
44 fprintf(help_stream
, "\n");
51 * This function aids in locating the start of help output.
53 void banner(const char *name
) {
54 const char *package_banner
= " Help Text, version ";
55 const char *section_banner
= "Section: ";
57 int plen
= strlen(package
) + strlen(package_banner
) + strlen(version
);
58 int slen
= strlen(section_banner
) + strlen(name
);
59 int len
= (plen
> slen
) ? plen
: slen
;
61 fprintf(help_stream
, BETWEEN_SECTIONS
);
63 fprintf(help_stream
, "%s%s%s\n", package
, package_banner
, version
);
64 fprintf(help_stream
, "%s%s\n", section_banner
, name
);
69 help(const char *package
, const char *invocation
, const char *version
) {
70 this->invocation
= invocation
;
71 this->package
= package
;
72 this->version
= version
;
73 this->help_stream
= stdout
;
77 * Describe how to use this program
83 "Usage: %s [<options>] <original-frame> [<supplemental-frame> ...] <output-file>\n"
84 " or: %s [<help option> ...]\n"
89 "--hu Usage (this message).\n"
90 "--hq Default settings.\n"
92 "--he Exclusion regions.\n"
93 "--ha Alignment (not exposure-related).\n"
94 "--hr Rendering (not exposure-related).\n"
96 "--ht Transformation data files.\n"
97 "--hc Control points.\n"
98 "--hl Filtering (PSFs, rendering chains).\n"
100 "--hi User Interfaces.\n"
101 "--hv Video stream processing (Experimental).\n"
102 "--h3 3D Modeling.\n"
103 "--hz Undocumented options.\n"
104 "--hA Concatenate all help pages.\n"
106 invocation
, invocation
, invocation
);
113 "Default settings:\n"
115 "--q0 Low quality, high speed. [default]\n"
116 "--qn Low noise, moderate speed.\n"
117 "--q1 Moderate quality and speed; high memory use.\n"
118 "--q2 High quality, low speed.\n"
119 "--qr Range-extended high quality.\n"
123 " --dchain fine:box:1,triangle:2\n"
124 " --achain triangle:2\n"
129 " --3d-chain fine:box:1,triangle:2\n"
131 "Low noise defaults:\n"
133 " --dchain sinc*lanc:6\n"
134 " --achain sinc*lanc:6\n"
139 " --3d-chain sinc*lanc:6\n"
143 " --dchain median:fine:sinc*lanc:8,triangle:2\n"
144 " --achain triangle:2\n"
149 " --3d-chain median:fine:sinc*lanc:8,triangle:2\n"
153 " --dchain sinc*lanc:8\n"
154 " --achain sinc*lanc:8\n"
159 " --3d-chain sinc*lanc:8\n"
161 "Range-extended defaults:\n"
163 " --dchain sinc*lanc:8\n"
164 " --achain sinc*lanc:8\n"
169 " --3d-chain sinc*lanc:8\n"
178 "Bit depth options:\n"
180 "--8bpc Write 8 bit per channel output [default]\n"
181 "--16bpc Write 16 bit per channel output\n"
183 "Output format options:\n"
186 "--auto Determine output file type automatically [default]\n"
187 "--raw Write raw PPM output\n"
188 "--plain Write plain PPM output\n"
190 "--raw Write raw PPM output [default]\n"
191 "--plain Write plain PPM output\n"
194 "Incremental output:\n"
196 "--inc Produce incremental output. [default]\n"
197 "--no-inc Don't produce incremental output.\n"
200 "Undefined values:\n"
202 "--def-nn <R> Use nearest-neighbor defined values within\n"
203 " radius <R>, zero outside. Default radius is 0.\n"
211 "Alignment channel options:\n"
213 "--align-all Align images using all color channels\n"
214 "--align-green Align images using the green channel\n"
215 "--align-sum Align images using a sum of channels [default]\n"
217 "Transformation options:\n"
219 "--translation Only adjust the position of images\n"
220 "--euclidean Adjust the position and orientation of images [default]\n"
221 "--projective Use projective transformations. Best quality, but slow.\n"
223 "Alignment following:\n"
225 "--identity Frames align closely with the original frame. [default]\n"
226 "--follow Frames align closely with their immediate predecessor.\n"
228 "Alignment failure:\n"
230 "--fail-optimal Frames beneath threshold are aligned optimally. [default]\n"
231 "--fail-default Frames beneath threshold keep their default alignment.\n"
233 "Transformation file operations:\n"
235 "--trans-load <x> Load initial transformation settings from file <x>\n"
236 "--trans-save <x> Save final transformation data in file <x>\n"
238 "Monte Carlo alignment (see --hq for defaults):\n"
240 "--mc <x> Align using, on average, x%% of available pixels (0 < x < 100)\n"
241 "--no-mc Align using all pixels.\n"
243 "Tunable parameters:\n"
245 "--metric=x Set the alignment error metric exponent. (2 is default)\n"
246 "--threshold=x Min. match threshold; a perfect match is 100. (0 is default)\n"
247 "--perturb-upper=x Perturbation upper bound pixels/arclength (14%% is default)\n"
248 " ('x%%' uses a fraction of the smallest image dimension.)\n"
249 "--perturb-lower=x Perturbation lower bound pixels/arclength (.125 is default)\n"
250 " ('x%%' uses a fraction of the smallest image dimension.)\n"
251 "--rot-upper=x Rotation-specific upper bound in degrees (32.0 is default)\n"
252 "--bda-mult=x Barrel distortion adjustment multiplier (0.0001 is default)\n"
253 "--bda-rate=x Barrel distortion rate of change maximum (0.0004 is default)\n"
254 "--lod-max=x LOD scale factor is max(1, (2^floor(x))/perturb) (1 is def.)\n"
256 "Certainty-weighted alignment:\n"
258 "--cw Weight alignment error by certainty.\n"
259 "--no-cw Don't weight alignment error by certainty. [default]\n"
261 "Alignment weight maps:\n"
263 "--wm <f> <x> <y> Use weight map image <f> at offset (<x>, <y>)\n"
265 "Frequency-weighted alignment:\n"
267 "--fl <h> <v> <a> High-pass filters: horizontal <h>, vertical <v>, average <a>.\n"
268 " Values should fall between 0 (pass all) and 1 (pass none).\n"
271 " NOTE: since this build of ALE does not link with FFTW,\n"
272 " this option is not supported. To use this option,\n"
273 " first re-build with FFTW support.\n"
276 "--flshow <o> Write high-pass filtered data to file <o>.\n"
278 "Algorithmic alignment weighting:\n"
280 "--wmx <e> <r> <d> Write reference <r>, definition <d>, execute `<e> <f> <d>`,\n"
281 " read weights <r> back.\n"
284 " NOTE: since this build was not configured for POSIX,\n"
285 " this option is not supported. To use this option,\n"
286 " first re-build with POSIX=1.\n"
289 "Perturbation Type [experimental]:\n"
291 "--perturb-output Apply perturbations in output image coordinates. [default]\n"
292 "--perturb-source Apply perturbations in source image coordinates.\n"
294 "Global searching:\n"
296 "--gs <type> Set global search to <type>, one of:\n"
297 " local Local alignment only [default]\n"
298 " inner Alignment reference image inner region\n"
299 " outer Alignment reference image outer region\n"
300 " all Union of inner and outer\n"
301 " central inner if below threshold or better; else, outer.\n"
302 " points Align by control points. Ignores gs-mo.\n"
303 "--gs-mo <x> Set <x> pixel min. overlap for global search. (16 is default)\n"
312 "Mimicking ALE 0.6.0 merging and drizzling (see --hl for details):\n"
314 " --dchain triangle:2 approximates merging.\n"
315 " --dchain fine:box:1 approximates drizzling.\n"
319 "--extend Increase image extents to accommodate all pixel data.\n"
320 "--no-extend Don't increase extents; crop to original frame. [default]\n"
322 "Tunable parameters:\n"
324 "--scale=x Scale images by the factor x, where x > 0. (1 is default)\n"
325 "--threshold=x Min. match threshold; a perfect match is 100. (0 is default)\n"
327 "Irani-Peleg iterative solver (see --hq for --ips defaults):\n"
329 "--ips <i> Run <i> iterations. (see also --hx, --hl and --hd)\n"
330 "--ip-mean Use the mean correction [default]\n"
331 "--ip-median Use the median correction\n"
334 "Unsharp Mask (was 'High-frequency Enhancement'):\n"
336 "--usm <m> Apply an unsharp mask with multiplier <m>.\n"
337 " (See also --device, --nlpsf, and --lpsf.)\n"
342 "--bayer <b> Set the bayer pattern to <b>, one of:\n"
343 " (clockwise from top left pixel)\n"
344 " rgbg Red-green-blue-green\n"
345 " gbgr Green-blue-green-red\n"
346 " grgb Green-red-green-blue\n"
347 " bgrg Blue-green-red-green\n"
348 " none RGB-RGB-RGB-RGB\n"
349 " Default is none or device-specific.\n"
351 "Color adjustment:\n"
353 "--exp-mult=c,r,b Adjust all channels by <c>, red by <r>, and blue by <b>.\n"
361 "Point-spread functions (used with --ips; see --hr):\n"
363 "--lpsf <p> Set linear colorspace point-spread function to <p>\n"
364 "--nlpsf <p> Set non-linear colorspace point-spread function to <p>\n"
365 " Available point-spread functions:\n"
367 " circle=<diameter>\n"
370 " <p>+<p> (summation)\n"
371 " <p>^<p> (convolution)\n"
372 " <n>*<p> (multiplication by a scalar <n>)\n"
373 " Default lpsf is either 'box=1.0' or device-specific.\n"
374 " Default nlpsf is either disabled or device-specific.\n"
376 "Incremental rendering chains:\n"
378 "--wt <w> Set weight threshold for defined pixels (default is 0.1).\n"
379 "--dchain <g> Use chain <g> to render the default output.\n"
380 "--ochain <g> <o> Use chain <g> to render output file <o>.\n"
381 "--achain <g> Use chain <g> to render the alignment reference image.\n"
382 "--afilter <s> Use SSF <s> to interpolate points in alignment.\n"
383 "--3d-chain <g> Use chain <g> by default to render 3d output.\n"
385 " triangle:2 ALE 0.6.0 merging (roughly)\n"
386 " fine:box:1 Drizzling (roughly)\n"
387 " fine:sinc*lanc:8 High-frequency preservation\n"
388 " last:nex:sinc*lanc:8 Useful for video stabilization\n"
389 " fine:box:1,triangle:2 Multi-resolution rendering\n"
390 " fine:sinc*lanc:8,sinc*lanc:8 Multi-resolution rendering\n"
391 " More precisely, chains <g> are one of:\n"
392 " <g1>,<g2> Chain <g1> where defined; <g2> elsewhere.\n"
393 " <i> Use rendering invariant <i>.\n"
394 " Rendering invariants <i> are:\n"
395 " avg:<e> Avg. (mean) value using SSFE <e>.\n"
396 " first:<e> First defined value using SSFE <e>.\n"
397 " last:<e> Last defined value using SSFE <e>.\n"
398 " max:<e> Maximum defined value using SSFE <e>.\n"
399 " min:<e> Minimum defined value using SSFE <e>.\n"
400 " median:<e> Median value using SSFE <e>.\n"
401 " <e> Same as avg:<e>.\n"
402 " Scaled sampling filters with exclusion (SSFE) <e> are:\n"
403 " ex:<s> Use SSF <s>; honor exclusion regions.\n"
404 " nex:<s> Use SSF <s>; don't honor exclusion regions.\n"
405 " <s> Same as ex:<s>\n"
406 " Scaled sampling filters (SSF) <s> are:\n"
407 " fine:<f> filter <f> at output image resolution.\n"
408 " coarse:<f> filter <f> at resolution MIN(in, out).\n"
409 " <f> Same as coarse:<f>.\n"
410 " Sampling filters <f> are:\n"
411 " sinc Sinc filter. (very large diameter)\n"
412 " lanc:<x> Lanczos, diameter <x>.\n"
413 " triangle:<x> Triangle, diameter <x>.\n"
414 " box:<x> Box, diameter <x>.\n"
415 " zero Zero function.\n"
416 " <f>*<f> Pointwise multiplication (windowing).\n"
418 " dchain (see --hq)\n"
419 " achain (see --hq)\n"
420 " afilter internal (approximates triangle:2)\n"
428 "Device (may set PSF, bayer pattern, exposure, and view angle):\n"
430 "--device <d> Set the capture device to <d>.\n"
431 " Available devices:\n"
434 " ov7620_raw_linear\n"
435 " canon_300d_raw_linear\n"
436 " canon_300d_raw_linear+50mm_1.4\n"
437 " canon_300d_raw_linear+50mm_1.4@1.4\n"
438 " canon_300d_raw_linear+50mm_1.8\n"
439 " canon_300d_raw_linear+85mm_1.8\n"
447 "Rendering-coordinate exclusion regions:\n"
449 "--ex <args> Exclude a specified volume.\n"
450 " <args> are space-delimited horizontal,\n"
451 " vertical, and frame limits:\n"
452 " <xmin> <xmax> <ymin> <ymax> <fmin> <fmax>\n"
453 " using unscaled rendering spatial coordinates.\n"
454 "--crop <args> Exclude the spatial complement of an area over a\n"
455 " specified set of frames. <args> are:\n"
456 " <xmin> <xmax> <ymin> <ymax> <fmin> <fmax>\n"
457 " using unscaled rendering spatial coordinates.\n"
459 "Frame-coordinate exclusion regions:\n"
461 "--fex <args> Exclude a specified volume.\n"
462 " <args> are space-delimited horizontal,\n"
463 " vertical, and frame limits:\n"
464 " <xmin> <xmax> <ymin> <ymax> <fmin> <fmax>\n"
465 " using unscaled frame spatial coordinates.\n"
466 "--fcrop <args> Exclude the spatial complement of an area over a\n"
467 " specified set of frames. <args> are:\n"
468 " <xmin> <xmax> <ymin> <ymax> <fmin> <fmax>\n"
469 " using unscaled frame spatial coordinates.\n"
477 "Certainty-weighted rendering (see --hq for defaults):\n"
479 "--cx <x> Render with certainty exponent <x>.\n"
480 "--no-cx Render with uniform certainty.\n"
482 "Options that may be useful when using --cx:\n"
483 "--ips <i> Uses one-sided certainty. (see --hr for details)\n"
484 "--exp-extend Extends the output range. (see below for details)\n"
486 "Exposure registration:\n"
488 "--exp-register Register exposure between frames. [default]\n"
489 "--exp-noregister Assume uniform exposure across all frames.\n"
490 "--exp-meta-only Use only image metadata for registering exposure.\n"
492 "Range extension (see --hq for defaults):\n"
494 "--exp-extend Extend range to include all calculated values.\n"
495 "--exp-noextend Restrict to the original frame's range.\n"
500 banner("Transformation data files");
503 "Version 2 syntax overview:\n"
506 "{supplemental frame 1 transformation}\n"
507 "{supplemental frame 2 transformation}\n"
510 "Version 3 syntax overview:\n"
513 "{original frame transformation}\n"
514 "{supplemental frame 1 transformation}\n"
515 "{supplemental frame 2 transformation}\n"
520 "V <x> Transformation data file version <x>.\n"
522 "Transformation overview:\n"
524 "{barrel/pincushion distortion command (optional; version 3 only)}\n"
525 "{projective, euclidean, or default command}\n"
527 "Barrel/pincushion distortion (version 3 only):\n"
529 "B <n> <coeff2> <coeff3> ... <coeff(n+1)>\n"
531 "Projective command:\n"
533 "P <xmax> <ymax> <tlx> <tly> <blx> <bly> <brx> <bry> <trx> <try>\n"
535 "Euclidean command:\n"
537 "E <xmax> <ymax> <xoffset> <yoffset> <angle>\n"
542 "# Lines beginning with '#' are comments.\n"
546 "# Version 3 transformation data file.\n"
548 "# Original frame, with barrel/pincushion distortion correction\n"
551 "# Supplemental frame 1: shift a 640x480 image right by 100 pixels\n"
552 "E 640 480 100 0 0\n"
557 banner("Video stream processing");
560 "Video stream processing [Experimental]:\n"
562 "--visp <args> Process a video sequence.\n"
564 " <chain> <stabilization-type> <prefix> <suffix>\n"
565 " <chain> is an incremental rendering chain. (see --hl)\n"
566 " <stabilization-type> is one of:\n"
567 " ma:<x> Moving average over 2*<x> + 1 frames\n"
568 " sf:<x> Stabilize to single frame number <x>\n"
569 " identity Same as ma:0\n"
570 " <prefix> is an output file prefix\n"
571 " <suffix> is an output file suffix\n"
572 "--visp-scale=<x> Use scale <x> for VISP output. (default is 1.0)\n"
573 "--exshow For single-invariant chains, show --ex regions dimmed.\n"
577 banner("User Interface");
582 "--ui=<type> Set user interface to <type>, one of:\n"
587 " NOTE: since ALE was compiled without ioctl support,\n"
588 " --ui=tty will behave identically to --ui=stream.\n"
589 " For additional output, recompile with IOCTL=1.\n"
594 banner("Control Points");
597 "Control point files:\n"
599 "--cpf-load=<f> Load control point data from file <f>\n"
603 banner("3D Modeling");
608 "--3dv <n> <o> Render, to file <o>, colors as viewed from frame <n>.\n"
609 "--3dd <n> <o> Render, to file <o>, depths as viewed from frame <n>.\n"
610 "--3dvp <args> <o> Render, to file <o>, colors viewed with projective <args>.\n"
611 "--3ddp <args> <o> Render, to file <o>, depths viewed with projective <args>.\n"
612 " <args> are W H V x y z P Y R:\n"
615 " V camera view angle.\n"
616 " x translation x component.\n"
617 " y translation y component.\n"
618 " z translation z component.\n"
619 " P rotation around x-axis.\n"
620 " Y rotation around y-axis.\n"
621 " R rotation around z-axis.\n"
622 "--occ-norm Normalize output with accumulated occupancy. [default]\n"
623 "--occ-nonorm Don't normalize output with accumulated occupancy.\n"
624 "--et <x> Set encounter threshold <x> for defined pixels. [default is 0]\n"
625 "--3dpx <args> Exclude a specified spatial volume following full-scene\n"
626 " reconstruction. <args> are:\n"
627 " <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>\n"
628 "--3d-filter Use filtering for 3D color output. [default]\n"
629 "--3d-nofilter Don't use filtering for 3D color output.\n"
630 "--3d-dmr <x> Set radius for filtering median depth to <x> [default 0]\n"
631 "--3d-fmr <x> Set radius for filtering median diff to <x> [default 0]\n"
632 "--focus <ft> <op> Create focus region with type <ft> and options <op>:\n"
634 " d <d> focus at distance <d>\n"
635 " p <x> <y> focus at point (x, y)\n"
636 " Space-separated options may include zero or more of:\n"
637 " ci=<ci> camera index [default 0]\n"
638 " fr=<fr> focal range [default 0]\n"
639 " ht=<ht> horizontal tilt gradient [default 0]\n"
640 " vt=<vt> vertical tilt gradient [default 0]\n"
641 " ap=<ap> aperture diameter [default 3]\n"
642 " sc=<sc> sample count [default 3]\n"
643 " sx=<sx> start x coordinate [default -Inf]\n"
644 " ex=<ex> end x coordinate [default Inf]\n"
645 " sy=<sy> start y coordinate [default -Inf]\n"
646 " ey=<ey> end y coordinate [default Inf]\n"
647 " sd=<sd> start depth [default 0]\n"
648 " ed=<ed> end depth [default Inf]\n"
649 " sr=<sr> view sample randomization:\n"
650 " aperture per aperture [default]\n"
652 " fs=<fs> focal statistic, one of:\n"
653 " mean mean of views [default]\n"
654 " median median of views\n"
657 "Camera parameters:\n"
659 "--view-angle <x> Set the initial diagonal view angle to <x> degrees.\n"
660 " (Default is 43.7 degrees or device-specific.)\n"
661 "--cpp-upper=<x> Set upper bound <x> for camera parameter perturbation,\n"
662 " in pixels or degrees [default is 32]\n"
663 "--cpp-lower=<x> Set lower bound <x> for camera parameter perturbation,\n"
664 " in pixels or degrees [default is 0.125]\n"
665 "--cpp-err-mean Use RMS error to determine camera parameters. [default]\n"
666 "--cpp-err-median Use median error to determine camera parameters. \n"
667 "--va-upper=<x> View-angle perturbation upper bound in degrees [default is 32]\n"
668 "--st <x> Set stereo threshold to <x> pixels. [default is 4]\n"
669 "--vp-adjust Adjust the view point [default]\n"
670 "--vp-noadjust Do not adjust the view point\n"
671 "--vo-adjust Adjust the view orientation [default]\n"
672 "--vo-noadjust Do not adjust the view orientation\n"
674 "Transformation file operations:\n"
676 "--3d-trans-load=x Load initial transformation settings from file x\n"
677 "--3d-trans-save=x Save final transformation data in file x\n"
681 "--di-upper <x> Decimate primary input resolution by at most 2^x [default is 0]\n"
682 "--di-lower <x> Decimate input resolutions by at least 2^x [default is 0]\n"
683 "--do-try <x> Decimate output resolution by 2^x if possible [default is 0]\n"
684 "--oc Clip scene to output regions.\n"
685 "--no-oc Do not clip scene to output regions. [default]\n"
686 "--fc <x> Set front-clip to <x> (0 < x < 1) [default is 0]\n"
687 "--rc <x> Set rear-clip to <x> (1 < x < inf) [default is inf]\n"
688 "--fx <x> Set falloff exponent to <x> [default is 0]\n"
689 "--tcem <x> Set third-camera error multiplier to <x> [default is 0]\n"
690 "--oui <x> Set occupancy update iterations to <x> [default is 10]\n"
691 "--pa <x> Set pairwise ambiguity to <x> [default is 3]\n"
692 "--pc <type> Set the type of pairwise comparisons:\n"
693 " auto Determine comparisons automatically. [default]\n"
694 " all Perform all comparisons.\n"
697 void undocumented() {
698 banner("Undocumented");
701 "Point-spread functions:\n"
703 "--psf-match <args> Can be used to evaluate PSFs. [details are undocumented]\n"
705 " <mr> <mg> <mb> <ar> <ag> <ab>\n"
707 " r[calibrated] = r[input] * <mr> + <ar>\n"
709 "Projective transformation calculator:\n"
713 "Traverse subspaces for 3D candidate selection:\n"
715 "--subspace-traverse\n"
721 #undef BETWEEN_SECTIONS