MediaOpts.C

Go to the documentation of this file.
00001 /*!@file Media/MediaOpts.C */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file:
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Media/MediaOpts.C $
00035 // $Id: MediaOpts.C 14535 2011-02-18 22:40:51Z siagian $
00036 //
00037 
00038 #ifndef MEDIA_MEDIAOPTS_C_DEFINED
00039 #define MEDIA_MEDIAOPTS_C_DEFINED
00040 
00041 #include "Media/MediaOpts.H"
00042 
00043 #include "Component/ModelOptionDef.H"
00044 #include "Image/Dims.H"
00045 #include "Image/Point2D.H"
00046 #include "Image/Rectangle.H"
00047 #include "Media/FrameRange.H"
00048 #include "Transport/TransportOpts.H"
00049 
00050 // Format here is:
00051 //
00052 // { MODOPT_TYPE, "name", &MOC_CATEG, OPTEXP_CORE,
00053 //   "description of what option does",
00054 //   "long option name", 'short option name', "valid values", "default value" }
00055 //
00056 
00057 // alternatively, for MODOPT_ALIAS option types, format is:
00058 //
00059 // { MODOPT_ALIAS, "", &MOC_ALIAS, OPTEXP_CORE,
00060 //   "description of what alias does",
00061 //   "long option name", 'short option name', "", "list of options" }
00062 //
00063 
00064 // NOTE: do not change the default value of any existing option unless
00065 // you really know what you are doing!  Many components will determine
00066 // their default behavior from that default value, so you may break
00067 // lots of executables if you change it.
00068 
00069 // #################### FrameSeries handling options:
00070 
00071 // Used by: InputFrameSeries, SaccadeControllers
00072 const ModelOptionDef OPT_InputFrameDims =
00073   { MODOPT_ARG(Dims), "InputFrameDims", &MOC_INPUT, OPTEXP_CORE,
00074     "Rescale input frames to fixed dims, or 0x0 for no rescaling",
00075     "rescale-input", '\0', "<width>x<height>", "0x0" };
00076 
00077 
00078 // Used by: OutputFrameSeries
00079 const ModelOptionDef OPT_OutputFrameDims =
00080   { MODOPT_ARG(Dims), "OutputFrameDims", &MOC_OUTPUT, OPTEXP_CORE,
00081     "Rescale output frames to fixed dims, or 0x0 for no rescaling",
00082     "rescale-output", '\0', "<width>x<height>", "0x0" };
00083 
00084 // Used by: OutputFrameSeries
00085 const ModelOptionDef OPT_OutputPreserveAspect =
00086   { MODOPT_FLAG, "OutputPreserveAspect", &MOC_OUTPUT, OPTEXP_CORE,
00087     "Preserve output frame aspect ratio if rescaling to fixed dims",
00088     "preserve-output-aspect", '\0', "", "false" };
00089 
00090 // Used by: OutputFrameSeries
00091 const ModelOptionDef OPT_OutputZoom =
00092   { MODOPT_ARG(int), "OutputZoom", &MOC_OUTPUT, OPTEXP_CORE,
00093     "Number of levels for output images to be zoomed larger (for positive "
00094     "values) or smaller (for negative values); e.g. a zoom level of -3 would "
00095     "reduce the image size by a factor of 8 in both width and height, while "
00096     "a zoom level of +4 would increase the image size by a factor of 16 in "
00097     "both width and height. This option is similar to --rescale-output, but "
00098     "is more useful in the case where you just want to scale the output to "
00099     "half its normal size, without having to know exactly what the normal "
00100     "size would be. It is also useful in cases where you will be generating "
00101     "multiple output streams with different natural sizes; in that case, "
00102     "--rescale-output would rescale them all to the same size, while "
00103     "--zoom-output lets you apply a uniform zoom to each of them so that "
00104     "their relative sizes are maintained.",
00105     "zoom-output", '\0', "<int>", "0" };
00106 
00107 // Used by: Mainly OutputFrameSeries
00108 const ModelOptionDef OPT_ZeroNumberFrames =
00109   { MODOPT_ARG(bool), "ZeroNumberFrames", &MOC_INPUT, OPTEXP_CORE,
00110     "Force all input and output frames to have the number 000000",
00111     "zero-number-frames", '\0', "<true|false>", "false" };
00112 
00113 // Used by: InputMPEGStream
00114 const ModelOptionDef OPT_InputMPEGStreamPreload =
00115   { MODOPT_ARG(bool), "InputMPEGStreamPreload", &MOC_INPUT, OPTEXP_CORE,
00116     "Whether to preload the entire mpeg input movie.",
00117     "preload-mpeg", '\0', "<true|false>", "false" };
00118 
00119 // Used by: InputFrameSeries
00120 const ModelOptionDef OPT_InputFrameCrop =
00121   { MODOPT_ARG(Rectangle), "InputFrameCrop", &MOC_INPUT, OPTEXP_CORE,
00122     "Crop input frames, or 0,0,0,0 for no cropping",
00123     "crop-input", '\0', "x1,y1,x2,y2", "0,0,0,0" };
00124 
00125 // Used by: InputFrameSeries
00126 const ModelOptionDef OPT_InputFrameRange =
00127   { MODOPT_ARG(FrameRange), "InputFrameRange", &MOC_INPUT, OPTEXP_CORE,
00128     "Input frame range and inter-frame delay or rate. The frame range "
00129     "can include optional specifications for the first frame (default "
00130     "value=0), last frame (default=MAX), and/or frame step (default=1). "
00131     "A fixed framerate can be specified either as an inter-frame interval, "
00132     "with a suffix one of {s,ms,us,ns}, or as a frame rate, with a suffix of Hz. "
00133     "A variable framerate can be specified with the name of a file (.fl) "
00134     "that contains precise frame timing information, with lines of the form:\n"
00135     "\t<name> <time>\n"
00136     "where:\n"
00137     "\t<name> is a string (no spaces) and\n"
00138     "\t<time> is the elapsed time from stimulus onset (in ms)\n"
00139     "\tthe <time> in the first line should be 0\n"
00140     "\tthe <name> in the last line should be END\n"
00141     "\tthe <time> in the last line should mark the stimulus end time",
00142     "input-frames", 'M', "[[first[-step]]-[last]]@[delay_or_rate]",
00143     "0-1-MAX@30Hz" };
00144 
00145 // Used by: InputFrameSeries
00146 const ModelOptionDef OPT_InputFramesWrap =
00147   { MODOPT_FLAG, "InputFramesWrap", &MOC_INPUT, OPTEXP_CORE,
00148     "Whether to set the frame number back to the start if we reached the end. "
00149     "This needs the --input-frames to be set ",
00150     "input-frames-wrap", '\0', "", "false" };
00151 
00152 // Used by: InputFrameSeries
00153 const ModelOptionDef OPT_InputPreserveAspect =
00154   { MODOPT_FLAG, "InputPreserveAspect", &MOC_INPUT, OPTEXP_CORE,
00155     "Preserve input frame aspect ratio if rescaling to fixed dims",
00156     "preserve-input-aspect", '\0', "", "false" };
00157 
00158 
00159 
00160 // Used by: InputFrameSeries
00161 const ModelOptionDef OPT_InputEchoDest =
00162   { MODOPT_ARG_STRING, "InputEchoDest", &MOC_INPUT, OPTEXP_CORE,
00163     "Specify a destination for carbon-copies of the input frames. "
00164     "If more than one --in-echo is given, then the copies are sent "
00165     "to each destination in parallel.",
00166     "in-echo", '\0', "<raster|display|mpeg|none>", "none" };
00167 
00168 // Used by: InputFrameSeries
00169 const ModelOptionDef OPT_InputFrameSource =
00170   { MODOPT_ARG_STRING, "InputFrameSource", &MOC_INPUT, OPTEXP_CORE,
00171     "Specify a source of input frames. If this option is given "
00172     "multiple times, then only the last value will have any effect. "
00173     "The general expected form is [type]:[spec], where [type] specifies "
00174     "the type of input stream (such as raster files, a movie file, "
00175     "etc.), and [spec] provides additional information for the "
00176     "input stream (such as the name of the input files). In "
00177     "certain common cases, the [type] may be omitted if it can "
00178     "be inferred from the filename dot-extension spec, as in the "
00179     "case where the 'png' raster stream type can be inferred from "
00180     "the fact that the filename ends in '.png'. Also, for certain "
00181     "stream types, the [spec] is optional and may be omitted. "
00182     "There are several general input stream types: (1) raw input "
00183     "sources, which represent input images being read from some external "
00184     "source such as files on disk or input from a camera; (2) generated "
00185     "input sources, which represent images being generated online by "
00186     "the program, such as test stimuli; and (3) filters, which are "
00187     "input sources that generate images by transforming images that "
00188     "come from some other source. Filters can be chained together "
00189     "arbitrarily. Finally, some input sources may not be supported "
00190     "on every system, depending on the operating system and available "
00191     "libraries; unavailable input sources are still listed below "
00192     "but are specifically marked as being unavailable. Following is "
00193     "a list of possible stream types, their corresponding filename "
00194     "dot-extensions, and the format expected of their [spec]:\n"
00195 
00196     "\n\n"
00197     "RAW INPUT SOURCES\n"
00198     "        --in=raster:path/to/file#nnn#.[<width>x<height>].[ext]\n"
00199     "          Reads input from one or more raster files. The leading "
00200     "'raster:' may be omitted if the file has one of the known raster "
00201     "extensions: .pnm, .pgm, .ppm, .pbm, .pfm, .png, .jpeg, .jpg, .dpx, "
00202     ".rgb555, .rgb565, .rgb24, .rgb32, .yuv24, .yuyv, .uyvy, .yuv444, .yuv422, "
00203     ".yuv411, .yuv420, .yuv410, .yuv444p, .yuv422p, .yuv411p, .yuv420p, "
00204     ".yuv410p; or, any of the above with an additional .gz or .bz2 "
00205     "extension, in which case the image file will be transparently "
00206     "decompressed. If the given filename includes a pair of hashes "
00207     "('#'), then characters in between the hashes will be interpreted "
00208     "as a minimum numeric field width, and the frame number will be "
00209     "formatted as a zero-padded string to that minimum width, and "
00210     "will be substituted for the entire #nnn# sequence. As special "
00211     "cases, a single '#' is equivalent to '#6#', and '##' is equivalent "
00212     "to '#0#'. Thus a filename of foo#.png or foo#6#.png will cause "
00213     "the stream to read foo000000.png, foo000001.png, etc.; foo##.png "
00214     "or foo#0#.png will read foo0.png, foo1.png, etc.; and foo#3#.png "
00215     "will read foo000.png, foo001.png, etc. Note that for the "
00216     "raw formats that have no header information (e.g., rgb24, yuv420p), "
00217     "you need to specify the image dimensions somehow; the preferred "
00218     "method for doing this is to encode the dimensions as '.WWWxHHH' "
00219     "into a secondary dot-extension just prior to the pixel-format "
00220     "filename extension (this is the same filename format produced by "
00221     "--out=rawvideo). If no such .WWWxHHH is found in the filename, then "
00222     "the dimensions will be taken from the value passed to --yuv-dims, "
00223     "but this approach is deprecated.\n"
00224 
00225     "        --in=rasterlist:listfilename\n"
00226     "          Reads a list of raster file names from 'listfilename', "
00227     "with one file name per line. The corresponding images will be "
00228     "loaded as input frames, in the order in which they are listed in "
00229     "the list file. The raster files may be in any of the file formats "
00230     "accepted by --in=raster. Note that all of the files in the list "
00231     "must be of the same image type; that is, they must all have the "
00232     "same pixel format (such as RGB, grayscale, YUV420P, etc.), and "
00233     "they must all have the same image dimensions.\n"
00234 
00235     "        --in=movie:path/to/movie.[ext]\n"
00236     "          Reads input from a movie file. The leading 'movie:' may "
00237     "be omitted if the file has one of the known movie extensions: "
00238     ".avi, .mpg, .mpeg, .m4v, .mov, .flv, or .dv.\n"
00239 
00240     "        --in=mpeg:path/to/movie.[ext]\n"
00241     "          Equivalent to --in=movie; present for backward "
00242     "compatibility from when the only supported movie type was mpeg.\n"
00243 
00244     "        --in=mgz:path/to/file.mgz\n"
00245     "          Reads input frames from a file in our custom 'mgz' "
00246     "format, which is essentially a single file containing a "
00247     "gzip-compressed sequence of images. The leading 'mgz:' may be "
00248     "omitted if the given filename ends with a '.mgz' extension.\n"
00249 
00250     "        --in=mraw:path/to/file.[<width>x<height>].[ext]?.gz|.bz2?\n"
00251     "          Reads multiple raw-format input frames from a single "
00252     "file. Because this is a truly raw file format containing no header "
00253     "or formatting information, you must provide some auxiliary "
00254     "information by encoding it into the filename. Specifically, the "
00255     "file must end with two or three dot-extensions. The first "
00256     "dot-extension specifies the width and height dimensions of the "
00257     "video frames. The second specifies the pixel format (so the "
00258     "leading 'mraw:' may be omitted) as one of: .mrgb555, .mrgb565, "
00259     ".mrgb24, .mrgb32, .myuv24, .myuyv, .muyvy, .myuv444, .myuv422, .myuv411, "
00260     ".myuv420, .myuv410, .myuv444p, .myuv422p, .myuv411p, .myuv420p, "
00261     ".myuv410p. The optional third extension can be .gz or .bz2, in "
00262     "which case the video file will be transparently decompressed from "
00263     "gzip or bzip2 compression, respectively. For example, a valid "
00264     "usage would be \"--in=somemovie.640x480.myuv420p.gz\".\n"
00265 
00266     "        --in=xmlfile:path/to/file.xml\n"
00267     "          Reads input frames from an xml file which could contain "
00268     "MetaData. This can be used to train the biasing algorithm or for object "
00269     "recognition. The xml file can contain includes for other xml files. \n"
00270 
00271     "        --in=stimulus2D:path/to/file.stim2d\n"
00272     "          Reads a text file created by a matlab script createStim.m"
00273     " and generates input frames. createStim.m creates a text file which"
00274     " contains 1d time varying signals and the pixel location in an image"
00275     " they are assigned. Useful for creating 2d step, impulse etc. "
00276     " functions for testing systems with both spatial and temporal dynamics. \n"
00277 
00278     "        --in=v4l\n"
00279 #ifndef HAVE_LINUX_VIDEODEV_H
00280     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00281 #endif
00282     "          Reads input frames from a Video4Linux (V4L) framegrabber "
00283     "device. There is no [spec] option here; the framegrabber can be "
00284     "configured with ordinary command-line options which become "
00285     "available after --in=v4l is selected.\n"
00286 
00287     "        --in=v4l2\n"
00288 #ifndef HAVE_LINUX_VIDEODEV2_H
00289     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00290 #endif
00291     "          Reads input frames from a Video4Linux version 2 (V4L2) "
00292     "framegrabber device. There is no [spec] option here; the "
00293     "framegrabber can be configured with ordinary command-line "
00294     "options which become available after --in=v4l2 is selected.\n"
00295 
00296     "        --in=ieee1394\n"
00297 #ifndef HAVE_IEEE1394
00298     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00299 #endif
00300     "          Reads input frames from a Firewire camera using the "
00301     "libdc1394 library version 0.9 or 1.x. There is no [spec] option "
00302     "here; the camera can be configured with ordinary command-line "
00303     "options which become available after --in=ieee1394 is selected.\n"
00304 
00305     "        --in=dc1394v2\n"
00306 #ifndef HAVE_DC1394V2
00307     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00308 #endif
00309     "          Reads input frames from a Firewire camera using the "
00310     "libdc1394 library version 2.x. There is no [spec] option "
00311     "here; the camera can be configured with ordinary command-line "
00312     "options which become available after --in=dc1394v2 is selected.\n"
00313 
00314     "        --in=qtgrab\n"
00315 #ifndef HAVE_QUICKTIME_QUICKTIME_H
00316     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00317 #endif
00318     "          Reads input frames from a QuickTime camera using Apple's "
00319     "QuickTime library. There is no [spec] option here; the camera "
00320     "can be configured with ordinary command-line options which "
00321     "become available after --in=qtgrab is selected.\n"
00322 
00323     "        --in=rtsp://URL\n"
00324 #ifndef INVT_HAVE_LIVEMEDIA
00325     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00326 #endif
00327     "          Reads input frames from an rtsp source using livemedia libs. "
00328     "There is no [spec] option here; the camera "
00329     "can be configured with ordinary command-line options which "
00330     "become available after --in=rtsp is selected.\n"
00331 
00332 
00333     "\n\n"
00334     "GENERATED INPUT SOURCES\n"
00335     "        --in=random[:WxH]\n"
00336     "          Generates color input frames with R/G/B values drawn "
00337     "from a uniform random distribution on [0,255]. The optional WxH "
00338     "spec can be used to specify the dimensions of the generated "
00339     "images. The default image size is 320x240.\n"
00340 
00341     "        --in=dots[:WxH],MotionType\n"
00342     "          Generates artificial greyscale (but in PixRGB format) "
00343     "moving dots. [:WxH] indicate optional width and height of the stimulus "
00344     "The default image size is 320x240. "  
00345     "The motion type supported for now is: "
00346     "Foe[flags] for Focus of Expansion "
00347     "(flags: bit 2: haveMotion , bit1: have temporal gradient, bit 0: have spatial gradient)"
00348     "Planar for planar motion. "
00349     "We are working on rotation, random, and single dot motion. "
00350     "In addition user will be able to specify some of the critical parameters "
00351     "for each motion type. \n"
00352 
00353     "        --in=bars[:WxH],MotionType\n"
00354     "          Generates artificial greyscale (but in PixRGB format) "
00355     "bars. [:WxH] indicate optional width and height of the stimulus "
00356     "The default image size is 320x240. "  
00357     "The motion type supported for now is: "
00358     "Normal for a single vertical bar moving left to right, "
00359     "ApertureProblem for a 45deg bar moving left to right . "
00360     "In the future the user will be able to specify some parameters."
00361     "for each motion type. \n"
00362 
00363     "        --in=shiftedImage:path/image:MotionType\n"
00364     "          Generates moving color image stimuli "
00365     "The motion type supported for now is: "
00366     "foe for Focus of Expansion, "
00367     "planar for planar motion. "
00368     "We are working on rotation motion"
00369     "In addition user will be able to specify some of the critical parameters "
00370     "for each motion type. \n"
00371 
00372     "        --in=colorbars[:frameperiod]\n"
00373     "          Generates a series of 'color bars' test images which "
00374     "include bars of various colors, a set of grayscale bars, a frame "
00375     "counter, and a clock. The optional [frameperiod] can be used to "
00376     "specify the desired real-time inter-frame interval in any time "
00377     "units or Hz. Examples: --in=colorbars:100ms will generate one "
00378     "test frame every 100ms; --in=colorbars:4Hz will generate one "
00379     "test frame every 250ms (4Hz).\n"
00380 
00381     "        --in=life[:WxH]\n"
00382     "          Generates black+white input frames according to "
00383     "Conway's \"Game Of Life\", a cellular automata system. The "
00384     "optional WxH spec can be used to specify the dimensions of "
00385     "the generated images. The default image size is 320x240.\n"
00386 
00387     "        --in=World2D[:WxH]\n"
00388     "         Generates a simple world composed of 2D objects like "
00389     "square, lines, circles, and objects which are a combination of "
00390     "simpler objects. The optional WxH spec can be used to specify "
00391     "the dimensions of the generated images. The default image size "
00392     "is 256x256.\n "
00393 
00394 
00395     "\n\n"
00396     "INPUT FILTERS\n"
00397     "        --in=bob:<childtype:childspec>\n"
00398     "          This input type is a filter, whose [spec] is a nested "
00399     "type:spec specification. The filter applies bob deinterlacing to "
00400     "frames coming from the child input source. The bob deinterlacer "
00401     "forms deinterlaced images alternately from the 'top' and 'bottom' "
00402     "half-fields of the original image (corresponding to the even and "
00403     "odd-numbered scanlines). Each deinterlaced image is formed by "
00404     "linearly interpolating to fill in the missing scan lines. This "
00405     "type of deinterlacing generates twice as many frames, at twice the "
00406     "frame rate, as the original input source. This is called 'bob' "
00407     "deinterlacing because the resulting image sequence may appear "
00408     "to slightly bob up and down as it alternates between interpolated "
00409     "top fields and bottom fields. Examples: --in=bob:foo.mpg will "
00410     "deinterlace a movie; --in=bob:v4l will deinterlace the input "
00411     "coming from a Video4Linux framegrabber.\n"
00412 
00413     "        --in=bhf:<childtype:childspec>\n"
00414     "          This input type is a filter, whose [spec] is a nested "
00415     "type:spec specification. The filter applies linear interpolation "
00416     "deinterlacing to the bottom half-field of the original images.\n"
00417 
00418     "        --in=thf:<childtype:childspec>\n"
00419     "          This input type is a filter, whose [spec] is a nested "
00420     "type:spec specification. The filter applies linear interpolation "
00421     "deinterlacing to the top half-field of the original images.\n"
00422 
00423     "        --in=buf:<childtype:childspec>\n"
00424     "          This input type is a filter, whose [spec] is a nested "
00425     "type:spec specification. This input type buffers the input frames "
00426     "of its child input source into a frame queue using a background "
00427     "thread. Then, while callers in the main thread read frames out "
00428     "from the buffered input stream, the background thread continually "
00429     "tries to keep the queue filled. Command-line parameters are "
00430     "available to control the buffer size (--input-buffer-size), and "
00431     "also to control the desired behavior if the queue underflows "
00432     "(--underflow-strategy), i.e., if somebody in the main thread "
00433     "tries to read a frame while the queue is empty.\n"
00434     ,
00435     "in", '\0', "<[type]:[spec]>", "" };
00436 
00437 // Used by: InputFrameSeries, OutputFrameSeries
00438 const ModelOptionDef OPT_InputOutputComboSpec =
00439   { MODOPT_ARG_STRING, "InputOutputComboSpec", &MOC_INPUT, OPTEXP_CORE,
00440     "Specify both input and output with a single specification. Thus "
00441     "--io=type:foo is equivalent to --in=type:foo --out=type:foo. "
00442     "NOTE that this will only work if 'type' is valid for both input "
00443     "and output; currently that would include 'raster' and 'mpeg', but "
00444     "not 'display' (valid for output only) or 'random' (valid for "
00445     "input only).",
00446     // PROGRAMMER NOTE: We don't actually care what the /current/
00447     // value of this option is -- instead, we just catch each call
00448     // to this option and create a FrameOstream object as
00449     // appropriate.
00450     "io", '\0', "<intersection of valid values for --in and --out>", "" };
00451 
00452 // Used by: OutputFrameSeries
00453 const ModelOptionDef OPT_OutputFrameRange =
00454   { MODOPT_ARG(FrameRange), "OutputFrameRange", &MOC_OUTPUT, OPTEXP_CORE,
00455     "Output frame range and inter-frame delay or rate. See "
00456     "--input-frames for details on the expected format. "
00457     "Variable rates can be specified as with --input-frames, BUT NOTE "
00458     "that some output formats (e.g., movie encoders) may not preserve "
00459     "the variable framerate information.",
00460     "output-frames", 'R', "[[first[-step]]-[last]]@[delay_or_rate]",
00461     "0-1-MAX@30Hz" };
00462 
00463 // Used by: OutputFrameSeries
00464 const ModelOptionDef OPT_OutputFrameSink =
00465   { MODOPT_ARG_STRING, "OutputFrameSink", &MOC_OUTPUT, OPTEXP_CORE,
00466     "Specify a destination for output frames. This option may be "
00467     "called multiple times to build up an internal list of multiple "
00468     "parallel output destinations. If --out=none is given, then any "
00469     "previous --out selections are canceled. The general output "
00470     "paradigm is that the program may generate multiple streams of "
00471     "output, and each of those streams may be feed to one or more "
00472     "output destinations selected by --out options. For example, "
00473     "the program might generate output streams named 'MapA' and 'MapB', "
00474     "and if --out=pnm is selected, then ultimately the generated files "
00475     "will be named MapA000000.pnm, MapA000001.pnm, etc. and "
00476     "MapB000000.pnm, MapB000001.pnm, etc.\n"
00477 
00478     "\n\n"
00479     "The general expected form of the argument to a --out option is "
00480     "[type]:[spec], where [type] specifies the type of output stream "
00481     "(such as raster files, movie files, onscreen windows, etc.), and "
00482     "[spec] provides additional information for the output stream (such "
00483     "as a prefix for the output file names). In certain common cases, "
00484     "the explicit [type] may be omitted if it can be inferred from the "
00485     "filename dot-extension spec. Also, for certain stream types, the "
00486     "[spec] is optional and may be omitted. There are several general "
00487     "output stream types: (1) disk output destinations, in which "
00488     "the output is saved in some form to one or more files on disk; "
00489     "(2) GUI output destinations, in which the output images are "
00490     "displayed in some type of GUI window(s); (3) text output "
00491     "destinations, in which some information about the output images "
00492     "is printed to the console; and (4) filters, which are output "
00493     "destinations that merely transform the output on its way to a "
00494     "final destination (for example, splitting an RGB image into its "
00495     "individual color components). Finally, some output destinations "
00496     "may not be supported on every system, depending on the operating "
00497     "system and available libraries; unavailable output destinations "
00498     "are still included in the list below but are specifically marked "
00499     "as being unavailable. Following is a list of possible output "
00500     "stream types and the format expected of their [spec] options. "
00501     "In the descriptions below, the phrase KEY refers to the output "
00502     "stream name produced by the program (such as 'MapA' or 'MapB' "
00503     "in the previous example), and which is NOT controllable from the "
00504     "command-line.\n"
00505 
00506     "\n\n"
00507     "DISK OUTPUT DESTINATIONS\n"
00508     "        --out=raster:fileprefix\n"
00509     "        --out=raster:path/to/fileprefix#nnn#\n"
00510     "          Images will be saved to individual raster files on "
00511     "disk. The format of the image files will be deterined by the "
00512     "--output-format option (default=PNM). The filenames will consist "
00513     "of several parts, including the fileprefix given in the [spec], "
00514     "the KEY provided by the program, the frame number, and the filename "
00515     "extension appropriate to the image file format, in this format: "
00516     "[fileprefix]-[KEY][framenumber][.ext]. The hyphen between "
00517     "[fileprefix] and [KEY] is omitted if the fileprefix ends with a '/' "
00518     "(that is, it just specifies a directory prefix). By default, the "
00519     "frame number portion of the filename will be a 6-digit zero padded "
00520     "number, but the length of zero padding can also be specified in the "
00521     "fileprefix. If the fileprefix includes a pair of hashes ('#'), then "
00522     "the characters between the hashes will be interpreted as a minimum "
00523     "field width, and the frame number will be formatted as a string with "
00524     "zero-padding to fill that minimum width. As special cases, a single "
00525     "'#' is equivalent to '#6#', and '##' is equivalent to '#0#'. Note "
00526     "that the location of this hash sequence within the fileprefix is "
00527     "irrelevant; the frame number will always appear at the end of the "
00528     "filename, just before the filename extension. For example, "
00529     "an unadorned --out=raster will produce KEY000000.pnm, KEY000001.pnm, "
00530     "etc.; --out=raster:foo/bar will produce foo/bar-KEY000000.pnm, "
00531     "foo/bar-KEY000001.pnm, etc; --out=raster:foo/#2# will produce "
00532     "foo/KEY00.pnm, foo/KEY01.pnm, etc; --out=raster:## will produce "
00533     "KEY0.pnm, KEY1.pnm. If the fileprefix includes a directory "
00534     "component, then that directory must already exist.\n"
00535 
00536     "        --out=pnm[:fileprefix]\n"
00537     "        --out=pgm[:fileprefix]\n"
00538     "        --out=ppm[:fileprefix]\n"
00539     "        --out=pbm[:fileprefix]\n"
00540     "          Like --out=raster with the image file format set to PNM "
00541     "(Portable aNyMap). Despite the different option names here, the "
00542     "output files generated will always have a '.pnm' extension.\n"
00543 
00544     "        --out=pfm[:fileprefix]\n"
00545     "          Like --out=raster with the image file format set to PFM, "
00546     "which is our custom format to hold 32-bit floating-point values in a "
00547     "plain file format similar to PNM. The filename extension will be "
00548     "'.pfm'. These files can be read back in by various programs in the "
00549     "toolkit, and can be read into matlab with pfmread.m. This file "
00550     "format encodes only grayscale images, so color images will be "
00551     "converted to their luminance prior to saving in PFM format.\n"
00552 
00553     "        --out=png[:fileprefix]\n"
00554     "          Like --out=raster with the image file format set to PNG "
00555     "(Portable Network Graphics). The filename extension will be '.png'.\n"
00556 
00557     "        --out=rawvideo[:fileprefix]\n"
00558     "          Like --out=raster with the image file format set to "
00559     "RAWVIDEO. This is a raw file format in which the file contents "
00560     "include only the raw image pixels; the file itself does not "
00561     "indicate the image dimensions or the pixel type. Both of these "
00562     "pieces information are, however, encoded into the filename "
00563     "extension, which will be of the form '.WWWxHHH.PIXFMT', where "
00564     "WWW and HHH are the image width and height, and PIXFMT is one of "
00565     "'rgb555', 'rgb565', 'rgb24', 'rgb32', 'yuv24', 'yuyv', 'uyvy', 'yuv444', "
00566     "'yuv422', 'yuv411', 'yuv420', 'yuv410', 'yuv444p, 'yuv422p', "
00567     "'yuv411p, 'yuv420p', or 'yuv410p', as appropriate. These files "
00568     "can be subsequently read back in with the --in option.\n"
00569 
00570     "        --out=txt[:fileprefix]\n"
00571     "          Like --out=raster with the image file format set to TXT. "
00572     "The filename extension will be '.txt'. This is a plain-text file "
00573     "format in which image pixels are simply written as space-separated "
00574     "strings, with one row of pixels per line of text. Color pixels are "
00575     "written as individual R, G, B values. Thus, a line of pixels from a "
00576     "color image would be encoded as R1 G1 B1 R2 G2 B2 R3 G3 B3, etc. "
00577     "Files generated in this format can be read by matlab's load() "
00578     "function.\n"
00579 
00580     "        --out=ccode[:fileprefix]\n"
00581     "          Like --out=raster with the image file format set to "
00582     "CCODE. The filename extension will be '.C'. In this format, images "
00583     "are encoded as C++ source code suitable for pasting back into "
00584     "a source file in this toolkit. The generated source will include "
00585     "one int variable for the image width, one for the image height, and "
00586     "one C-style array containing the image pixels in row-major format.\n"
00587 
00588     "        --out=bkg-rawvideo:pfx1,pfx2,pfx3,...\n"
00589     "          Similar to --out=rawvideo, but in this case the actual file "
00590     "writing happens in a background thread. This is useful on multi-core "
00591     "machines in cases where the main thread is fully occupied with some "
00592     "other task or has other real-time constraints. The generated "
00593     "filenames are of the form [pfx][KEY][NNNNNN][.ext], where [pfx] "
00594     "cycles through the list of prefixes given in the [spec]. This allows "
00595     "output image files to be striped across multiple directories and "
00596     "even multiple physical disks, which can help to maximize usage of "
00597     "available disk bandwidth. For example, assuming 640x480 YUV420P "
00598     "files are being saved with --out=bkg-rawvideo:/disk1/a/,/disk2/b/, "
00599     "then the generated files will be "
00600     "/disk1/a/KEY000000.640x480.yuv420p, "
00601     "/disk2/b/KEY000001.640x480.yuv420p, "
00602     "/disk1/a/KEY000002.640x480.yuv420p, "
00603     "/disk2/b/KEY000003.640x480.yuv420p, etc.\n"
00604 
00605     "        --out=movie[:fileprefix]\n"
00606 #ifdef INVT_HAVE_AVCODEC
00607     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00608 #endif
00609     "          One movie file will be generated for each KEY, named as "
00610     "[fileprefix][KEY][.ext]. The filename extension will be appropriate "
00611     "to the movie codec selected with --output-codec. The video encoding "
00612     "is handled by the ffmpeg library.\n"
00613 
00614     "        --out=mpeg[:fileprefix]\n"
00615 #ifdef INVT_HAVE_AVCODEC
00616     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00617 #endif
00618     "          An alias for --out=movie.\n"
00619 
00620     "        --out=ucbmpeg[:fileprefix]\n"
00621 #ifndef MPEGENCODE_PROG
00622     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00623 #endif
00624     "          Like --movie, but the video encoding is handled by "
00625 #ifdef MPEGENCODE_PROG
00626     MPEGENCODE_PROG
00627 #else
00628     "ppmtompeg or mpeg_encode (but neither of those was found on "
00629     "this system)"
00630 #endif
00631     ".\n"
00632 
00633     "        --out=mgz[:fileprefix]\n"
00634     "          Like --out=movie, but the output files will be saved "
00635     "in a custom 'mgz' format. The format is essentially a "
00636     "gzip-compressed sequence of raw images, all in a single file.\n"
00637 
00638     "        --out=mraw[:fileprefix]\n"
00639     "          Generates multi-frame raw files containing concatenated "
00640     "rawvideo frames. The resulting files are completely identical to a "
00641     "concatenation of the individual files generated with --out=rawvideo; "
00642     "however, if you are going to be saving hundreds or thousands of "
00643     "frames, then it may be more efficient (in terms of operating system "
00644     "and disk overhead) to save them into a single file with --out=mraw "
00645     "than to save into individual files with --out=rawvideo. Like "
00646     "--out=rawvideo, this multi-frame format is a truly raw format with "
00647     "only pixel data in the file itself; therefore, critical metadata "
00648     "(image dimensions and pixel format) are encoded into the filename. "
00649     "The filename will have an extension of the form '.WWWxHHH.mPIXFMT' "
00650     "(similar to the --out=rawvideo format, but note the extra 'm' "
00651     "denoting \"multi-frame\"); WWW and HHH specify the image dimensions "
00652     "and PIXFMT specifies the pixel format, as described for "
00653     "--out=rawvideo. The multi-frame files generated by --out=mraw can be "
00654     "subsequently read back in with a --in=mraw option. Note that "
00655     "although --in=mraw can read gzip- or bzip2-compressed files, "
00656     "--out=mraw cannot generate such files directly; rather, you can "
00657     "generate an an uncompressed file with --out=mraw, then compress it "
00658     "separately with gzip or bzip2, and then read the compressed file "
00659     "back in with --in=mraw.\n"
00660 
00661     "\n\n"
00662     "GUI OUTPUT DESTINATIONS\n"
00663     "        --out=display\n"
00664     "          Image files are sent to X11 windows on the display "
00665     "specified by the $DISPLAY environment variable, or :0.0 if $DISPLAY "
00666     "is unset. One window is generated for each KEY, and the KEY name "
00667     "is used as a window title.\n"
00668 
00669     "        --out=sdl\n"
00670 #ifndef HAVE_SDL_SDL_H
00671     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00672 #endif
00673     "          Image files are sent to an SDL window. This option "
00674     "can only be used when there is exactly one KEY. The parameters "
00675     "(size, etc.) of the SDL window can be controlled with other "
00676     "command-line parameters.\n"
00677 
00678     "        --out=qt\n"
00679 #ifndef INVT_HAVE_QT3
00680     "          NOTE: THIS OPTION IS NOT SUPPORTED ON THIS SYSTEM\n"
00681 #endif
00682     "          Image files are sent to a Qt window. This window holds "
00683     "all KEY streams using a tabbed interface: individual KEY streams "
00684     "can be selected for viewing by clicking on their names in the "
00685     "listbox on the left side of the window. The image display pane, "
00686     "on the right side of the window, shows the image itself (at bottom), "
00687     "along with auxiliary information about the image (at top), including "
00688     "its KEY name, a more detailed description of the image (if "
00689     "available), its dimensions, and its image/pixel format. The image "
00690     "display pane also includes a spinbox to zoom the image in/out, as "
00691     "well as a button that can be used to save any displayed image as a "
00692     "raster file. The main window also includes a pause button that can "
00693     "be used to stop a simulation so that the various images can "
00694     "reviewed.\n"
00695 
00696     "\n\n"
00697     "TEXT OUTPUT DESTINATIONS\n"
00698     "        --out=hash[:filename]\n"
00699     "          Write a simple checksum hash of each image to the given "
00700     "filename. If the filename is omitted, or is given as '' (the empty "
00701     "string) or '-' or 'stdout' or 'STDOUT', then the checksums will be "
00702     "written to stdout; likewise, if the filename is 'stderr' or 'STDERR', "
00703     "then the checksums will be written to stderr. In all other cases, the "
00704     "checksums will be written to the named file.\n"
00705 
00706     "        --out=info[:filename]\n"
00707     "          At program shutdown time, write a summary of the number, "
00708     "size, and type of frames written for each KEY. The summary is written "
00709     "to stdout, stderr, or a named file, based on the given filename, in "
00710     "the same way as described for --out=hash.\n"
00711 
00712     "        --out=stats[:filename]\n"
00713     "          Write a simple stats summary of output image, including "
00714     "the min/mean/stdev/max values for grayscale images, and the "
00715     "min/mean/stdev/max values for each R,G,B channel in color images. "
00716     "Also, at program shutdown time, write an overall stats summary for "
00717     "each KEY of all the images written for that KEY. The stats are "
00718     "written to stdout, stderr, or a named file, based on the given "
00719     "filename, in the same ways as described for --out=hash.\n"
00720 
00721     "\n\n"
00722     "OUTPUT FILTERS\n"
00723 
00724     "        --out=null\n"
00725     "          A special output destination that simply discards any "
00726     "frames it receives. Note that this is different from --out=none: "
00727     "whereas --out=none cancels any previous --out options, --out=null "
00728     "is just another output destination that happens to do nothing.\n"
00729 
00730     "        --out=splitrgb:destination\n"
00731     "          An output filter that splits color images into their "
00732     "individual R,G,B components, and then passes those components on to "
00733     "the destination specified by the [spec]. The [spec] should be "
00734     "another output destination, just as would normally be passed to "
00735     "--out. When the components are passed to the next destination, their "
00736     "KEY names are altered to include '-r', '-g', or '-b' suffixes, as "
00737     "appropriate. For example, --out=splitrgb:pnm would split color "
00738     "images into their components and then save those components to pnm "
00739     "files named KEY-r000000.pnm, KEY-g000000.pnm KEY-b000000.pnm etc. "
00740     "Grayscale images passing through splitrgb will also be \"split\" "
00741     "into components, but those components will just happen to be "
00742     "identical.\n"
00743 
00744     "        --out=luminance:destination\n"
00745     "          An output filter that converts color images into their "
00746     "luminance images, and then passes those luminance images on to the "
00747     "destination specified by the [spec]. As with --out=splitrgb, the "
00748     "[spec] is just another output destination, as would normally be "
00749     "passed to --out. Color images passing through --out=luminance will "
00750     "have their KEY names modified with a '-lum' suffix; grayscale images "
00751     "will pass through unaltered, and their KEY names will remain "
00752     "unaltered as well.\n"
00753 
00754     "        --out=colorize:destination\n"
00755     "          An output filter that colorizes grayscale images with a "
00756     "colormap. For now, the colormap is like matlab's 'jet' colormap and "
00757     "cannot be changed. Grayscale images passing through --out=colorize "
00758     "will have their KEY names modified with a '-colorized' suffix; "
00759     "images that are already in color will pass through unaltered, and "
00760     "their KEY names will remain unaltered as well.\n"
00761 
00762     "        --out=coerce-grey:destination\n"
00763     "        --out=coerce-rgb555:destination\n"
00764     "        --out=coerce-rgb565:destination\n"
00765     "        --out=coerce-rgb24:destination\n"
00766     "        --out=coerce-rgb32:destination\n"
00767     "        --out=coerce-yuv24:destination\n"
00768     "        --out=coerce-yuyv:destination\n"
00769     "        --out=coerce-uyvy:destination\n"
00770     "        --out=coerce-yuv444:destination\n"
00771     "        --out=coerce-yuv422:destination\n"
00772     "        --out=coerce-yuv411:destination\n"
00773     "        --out=coerce-yuv444p:destination\n"
00774     "        --out=coerce-yuv422p:destination\n"
00775     "        --out=coerce-yuv411p:destination\n"
00776     "        --out=coerce-yuv420p:destination\n"
00777     "        --out=coerce-yuv410p:destination\n"
00778     "          Output filters that coerce images into a given rawvideo "
00779     "format, if possible. Some coercions are atomic (implemented by a "
00780     "single conversion function), while the remaining coercions are "
00781     "implemented by the optimal sequence of atomic conversions. The "
00782     "optimal sequence for a given conversion is the one that meets "
00783     "the following criteria, in order of preference: (1) minimizes "
00784     "the number of lossy colorspace conversions, like rgb->yuv, "
00785     "yuv->rgb, rgb->grey, or yuv->grey; (2) minimizes the number of "
00786     "lossy spatial resolution conversions, like yuv444->yuv422 or "
00787     "yuv444->yuv410p; (3) minimizes the number of lossy bit depth "
00788     "conversions, like rgb24->rgb565 or rgb->555; (4) minimizes the "
00789     "total number of atomic conversion steps.\n"
00790 
00791     ,
00792 
00793     // PROGRAMMER NOTE: We don't actually care what the /current/
00794     // value of this option is -- instead, we just catch each call
00795     // to this option and create a FrameOstream object as
00796     // appropriate.
00797     "out", '\0', "<[type]:[spec]>", "" };
00798 
00799 // Used by: InputFrameSeries, OutputFrameSeries
00800 const ModelOptionDef OPT_WaitForUser =
00801   { MODOPT_FLAG, "WaitForUser", &MOC_OUTPUT, OPTEXP_CORE,
00802     "Whether to wait for a keypress after each input/output frame",
00803     "wait", '\0', "<true|false>", "false" };
00804 
00805 // Used by: InputFrameSeries
00806 const ModelOptionDef OPT_KeepGoing =
00807   { MODOPT_FLAG, "KeepGoing", &MOC_OUTPUT, OPTEXP_CORE,
00808     "Keep going even after input is exhausted",
00809     "keep-going", '+', "", "false" };
00810 
00811 // Used by: OutputFrameSeries
00812 const ModelOptionDef OPT_OutputReplicate =
00813   { MODOPT_ARG(uint), "OutputReplicate", &MOC_OUTPUT, OPTEXP_CORE,
00814     "How many times to replicate each output frame. This is useful "
00815     "if you want to generate a '15fps' mpeg1 movie; mpeg1 doesn't "
00816     "support 15fps, but it does support 30fps so if you use 30fps "
00817     "with output replication of 2, then you will effectively end "
00818     "up with a 15fps movie.",
00819     "output-replicate", '\0', "uint", "1" };
00820 
00821 // ######################################################################
00822 /* So things look consistent in everyone's emacs... */
00823 /* Local Variables: */
00824 /* indent-tabs-mode: nil */
00825 /* End: */
00826 
00827 #endif // MEDIA_MEDIAOPTS_C_DEFINED
Generated on Sun May 8 08:41:01 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3