home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / wincam.zip / winc.man < prev    next >
Text File  |  1997-05-16  |  23KB  |  558 lines

  1.  
  2.  
  3.  
  4. WINC(1)                              WINC(1)
  5.  
  6.  
  7. NAME
  8.        winc  -    command     line interface to the WinCam.One digital
  9.        camera
  10.  
  11. SYNOPSIS
  12.        winc [-options]
  13.  
  14. DESCRIPTION
  15.        winc gives UNIX shell access to the digital  camera  known
  16.        as the WinCam.  It is a 640x480 capable color digital cam-
  17.        era, interfaced to a computer via  a  serial  cable.   See
  18.        http://www.wincam.com for more information about this cam-
  19.        era.
  20.  
  21.        Images grabbed by winc are dumped in PGM or PNM format  to
  22.        the  standard  output, with the intention that they be run
  23.        through other tools to be converted to the desired format,
  24.        e.g.:
  25.  
  26.        winc -g -2 | cjpeg >image.jpg
  27.  
  28.        (The cjpeg command referred to is available as part of the
  29.        Independent JPEG Group's distribution  of  jpeg    software.
  30.        The PGM, PNM, and PBM formats are specified as part of the
  31.        widely available netpbm utilities.  Both of these packages
  32.        are  probably  available     at  the same place you found the
  33.        winc code.)
  34.       
  35.        (OS/2 Note:  The Independent JPEG Group's JPEG Software v 6a 
  36.        is currently at: 
  37.            ftp://hobbes.nmsu.edu/old/os2/graphics/jpeg6a_os2a.zip
  38.  
  39.        The GBM Utils also deal with the PNM format - they can 
  40.        currently be found at:
  41.        ftp://hobbes.nmsu.edu/old/os2/graphics/gbm.zip
  42.  
  43.        As the Hobbes archive is re-organizing as this is being written,
  44.        expect this to change. )
  45.     
  46.        Although this software processes the full 492 lines avail-
  47.        able  to     the  camera,  there may be some residual effects
  48.        from the CCD (Charge Coupled Device) in the camera visible
  49.        in  the    first  and last few lines.  Hence the claimed 480
  50.        line resolution.
  51.  
  52. OPTIONS
  53.        There are far too many  options    to  this  program,  as    a
  54.        result  of  its    being  a  development  tool  for the winc
  55.        library in addition to the basic     image    capture     command.
  56.        The  important  options    to  know about are -c (color), -g
  57.        (greyscale),  -2     (double  scan),  -z   (zoom/scale),   -b
  58.        (brightness),  and  -l  (lighting).   The image will go to
  59.        stdout by default.  winc will  do  nothing  useful  except
  60.        find the camera (i.e. no image will be snapped) unless one
  61.        of -c, -g, or -v is present.
  62.  
  63.        -h     prints the short usage message.
  64.  
  65.        -H     prints the full usage message, since it's so  long.
  66.  
  67.        -c     Grabs  a    color  image.    Color  images are 24 bits
  68.           deep, with 255 values for each of red,  green,  and
  69.           blue.   The  default size is 640x492.  Output is in
  70.           PNM format.
  71.  
  72.        -g     Grabs a greyscale image.    Greyscale  images  are    8
  73.           bits  deep,  with a maximum grey level of 255.  The
  74.           default size is 640 by 492.  Output is in PGM  for-
  75.           mat.
  76.  
  77.        -v     captures    a  "viewfinder" image.    Viewfinder images
  78.           are 64 by 48 greyscale imagemaps, with grey  values
  79.           in  the  range 0 to 15.  Because they are small and
  80.           "shallow", they take much     less  time  to     download
  81.           from the camera.    Output is in PGM format.
  82.  
  83.        -2     Normally    images    are captured in a single scan: in
  84.           this mode, of the 492 lines  in  a  default  image,
  85.           only  the     even  rows are "real";     the odd rows are
  86.           created by averaging between  the     rows  above  and
  87.           below.   If the subject matter is still enough, the
  88.           -2 option can be used to force a second scan  about
  89.           1/8th of a second later.    This will fill in the odd
  90.           rows with real data.
  91.  
  92.        -z N   Sets the viewfinder zoom factor to 1, 2, 4,  or  8,
  93.           or  for  full images, sets the full image reduction
  94.           factor.  Viewfinder images normally show    the  full
  95.           field  of     view at low resolution, but specifying a
  96.           zoom of 8 will yield the camera's     maximum  resolu-
  97.           tion  in    a relatively small area.  This can assist
  98.           in focusing the camera lens  (which  must     be  done
  99.           manually    --  loosen  the     screw!).  Regular images
  100.           cannot be zoomed, but can instead have their  reso-
  101.           lution  and  overall dimension reduced.  This might
  102.           be done when the full imagesize  or  resolution  is
  103.           not  wanted  or  needed.    The full field of view is
  104.           preserved.  The values 1, 2,  4,    and  8    represent
  105.           linear  scaling of both the horizontal and vertical
  106.           axes.  Thus "-z 2" gives an image that  is  160x123
  107.           rather than the default 640x492.    (So actually, the
  108.           arguments should really be 1, 4, 16, and 64.)
  109.  
  110.        -l lighting
  111.           Affect the color balance of the image.   See  COLOR
  112.           BALANCE below.
  113.  
  114.        -b NN  Sets  the     "brightness" goal for the camera.  Expo-
  115.           sure will be adjusted automatically in  an  attempt
  116.           to  reach     this  percentage  of  full  white.   The
  117.           default value is 50 (percent).
  118.  
  119.        -S NN  Saves a the threshold above which a pixel     is  con-
  120.           sidered  "bad".  See the section below on STARFIELD
  121.           CORRECTION for more information.
  122.  
  123.        -e NN or -E NN
  124.           Sets exposure in milliseconds(-e)     or  microseconds
  125.           (-E).   The  shortest  possible  exposure     time  is
  126.           1/100,000th of a second, the longest  is    a  little
  127.           over  1.3 seconds.  If neither option is used, winc
  128.           will try several exposures until the average  pixel
  129.           brightness goal is reached (see -b).
  130.  
  131.        -a     Sound an audible alarm when the picture is actually
  132.           snapped.    The process of "finding" the camera, tak-
  133.           ing  the    picture,  and  downloading  the     image is
  134.           fairly lengthy.  Hearing a small beep when the pic-
  135.           ture has been taken can be helpful.
  136.  
  137.        -o FILE
  138.           Normally    all  output  from winc will go to stdout.
  139.           This will cause output to go to the specified file-
  140.           name instead.  If -o is used, then the modification
  141.           time of "filename" will be set to the time at which
  142.           the  picture  was snapped, rather than being set by
  143.           the system to the time at which the  last     part  of
  144.           the  file was written.  (The time difference can be
  145.           tens of seconds.)
  146.  
  147.        -i IDSTRING
  148.           Specify the "name" of the camera to be used.   This
  149.           name  will  affect  the  way in which configuration
  150.           information will be looked up.  See the section  on
  151.           MULIPLE CAMERAS, below.
  152.  
  153.        -n     Leave  the image "narrow".  The natural image taken
  154.           by the camera looks tall and thin if viewed unmodi-
  155.           fied.  Normally a horizontal scaling is applied, to
  156.           bring it up to 640 wide, which makes circles  round
  157.           again.  Using -n suppresses this widening.  If this
  158.           is  done,     the  default  size  of     images     will  be
  159.           512x492.
  160.  
  161.        -r     Leave  a raw image, rather than one with brightened
  162.           corners.    The camera leaves the corners quite  dark
  163.           (half  as bright as the center), and winc will nor-
  164.           mally brighten them.  Using -r suppresses this.
  165.  
  166.        -G VAL Runs a gamma function on the  image,  which  is  an
  167.           exponential curve that affects some areas more than
  168.           others.  A value of 100 (or 0) will leave the image
  169.           unchanged.   Values  less than 100 will tend to dim
  170.           the image, values greater than  100  will     tend  to
  171.           brighten    it.   The  default  value  is  110, which
  172.           lightens shadowy areas.  The default value  is  set
  173.           with the WinCamGamma variable.
  174.  
  175.        -d     Runs  camera diagnostics.     If combined with -g, the
  176.           camera will download as an image the  pattern  left
  177.           in  memory as a result of the diagnostics, and this
  178.           can be viewed as a test pattern.
  179.  
  180.        -t tracestring
  181.           Turns on program tracing.     The argument is a string
  182.           of  consisting of traceflags.  Primarily for debug-
  183.           ging, this can be used to track down  configuration
  184.           problems of various sorts.  The possible flags are:
  185.            v just shows program and camera version information
  186.            V will turn on all possible messages
  187.            d for diagnostic tracing
  188.            e to get exposure information
  189.            a for simple API tracing
  190.            A for full API tracing
  191.            p for camera protocol
  192.            P for _all_ bytes of protocol
  193.            c for serial port control
  194.            l for camera lock/unlock tracing
  195.            g for graphics output routine tracing
  196.            r for winc.rc configuration file tracing
  197.            k for color processing tracing
  198.            x for program-level tracing (i.e outside the library)
  199.  
  200.        -f     The winc library supports a couple of ways of  tak-
  201.           ing  pictures.   Normally,  picture  processing  is
  202.           overlapped with the download of data from the  cam-
  203.           era.   The -f option causes a different set of rou-
  204.           tines to be used, which first  download,    and  then
  205.           process the image.
  206.  
  207.        -R     Data  retrieved  from the camera is dumped in Star-
  208.           Dot's .wcd format to stdout.
  209.  
  210.        -R -R  Data retrieved from the camera is     dumped     with  no
  211.           processing or conversion to stdout.
  212.  
  213.        -D     Raw  image  data    in  StarDot's .wcd format is read
  214.           from stdin.  The data is always  considered  to  be
  215.           double  scan,  so     effectively  a     '-2'  is forced.
  216.           Fractional scans are not supported, so the -z  flag
  217.           cannot be used.  The -g and -c flags are honored.
  218.  
  219.        -D -D  This   will   cause  raw    camera    data  (presumably
  220.           obtained with the "-R -R" option) to be  read  from
  221.           stdin,  and processed as usual.  The -z, -c, and -g
  222.           flags are still honored.
  223.  
  224. COLOR BALANCE
  225.        Either the -l option or the WinCamColor    variable  can  be
  226.        used  to     specify the lighting of the scene being snapped,
  227.        to affect the "color balance" of the  camera.   The  value
  228.        can  be    one  of     several  predefined strings ("sunlight",
  229.        "flourescent", "tungsten" (or  the  synonymous  "incandes-
  230.        cent"),    "halogen", "studio", "filter", "defaults"), or it
  231.        can be a parenthesized triple of percentages by    which  to
  232.        adjust  the  red, green, and blue components of the image,
  233.        respectively.  Default values are obtained by omitting  -l
  234.        entirely,  or  using  "-l defaults" or "-l (100,100,100)".
  235.        (The parentheses will need to be quoted from the shell.)
  236.  
  237.        Aliases for particular lighting needs can  be  set  up  by
  238.        defining environment or winc.rc (see CONFIGURATION, below)
  239.        variables  of  the  form      "WinCamColor_ALIASNAME".    For
  240.        instance,       one     might         define     "WinCam-
  241.        Color_backyard=(120,120,100)", and then refer to     it  with
  242.        "-l  backyard".    Aliases can also refer to the compiled-in
  243.        values, e.g.  "WinCamColor_office=flourescent".
  244.  
  245. STARFIELD CORRECTION
  246.        Like most CCD cameras, the WinCam will  have  some  pixels
  247.        that appear very bright when taking a picture in low light
  248.        conditions.  The effect when looking at a  dark    image  is
  249.        that it is speckled, or has a starry appearance.     The good
  250.        news is that the "bad" CCD sensors are fixed for     a  given
  251.        camera.     By  saving  a    reference  image,  the "starfield
  252.        effect" can be eliminated from later pictures.
  253.  
  254.        Use the -S option to create a reference image.    The  cam-
  255.        era's  lens  cap     should     be left on, so that it takes the
  256.        snap "in the dark".  The output is in the  PBM  monochrome
  257.        bitmap format.  The parameter to -S is the threshold above
  258.        which a pixel is considered "bad".  Values  of  20  to  50
  259.        seem  right,  apparently     depending on the camera.  It may
  260.        also  depend  on     the  temperature  of  the  camera.   The
  261.        starfield  image     can  be viewed with a program like xv to
  262.        see if it seems to have too many or too    few  "bad"  spots
  263.        recorded.  Test the starfield image by using it to correct
  264.        another normal image, also taken with the lens cap left in
  265.        place.    The  resulting    image should be (almost) entirely
  266.        dark, or at least much better than a similar  image  taken
  267.        without starfield correction.
  268.  
  269.        The  name  of  the file used for the reference is found in
  270.        the WinCamStarfield configuration variable.   The  easiest
  271.        way  to    test a new reference is to use a command like the
  272.        following:
  273.  
  274.        WinCamStarfield=starfield.pbm  winc -c -ta | xv -
  275.  
  276.        (assuming the reference    was  saved  in    "starfield.pbm").
  277.        When  satisfied    with  the  results, install the starfield
  278.        reference somewhere, and put its path in the winc.rc file.
  279.        Since  the reference image is camera-specific, if you have
  280.        more than one camera, be sure to use the camera's  identi-
  281.        fier  to qualify the WinCamStarfield variable.  See MULTI-
  282.        PLE CAMERAS, below.
  283.  
  284. LOCKING
  285.        
  286.        In the current version of the OS/2 port, winc.exe locks 
  287.        the com port while in use, and reliquishes it when done.
  288.  
  289. TIMEOUTS/BAUDRATE
  290.        The winc library normally chooses the highest baud rate at
  291.        which it can talk to the camera.     This  is  usually  fine.
  292.        However,     on  slower machines or substandard serial ports,
  293.        it may be that the camera can be "found", but  that  there
  294.        isn't  enough  throughput  to  reliably download an image.
  295.        ("Finding" a camera involves relatively    short  bursts  of
  296.        data  --     downloading  an image requires much more.)  This
  297.        will be reflected by timeout  errors.     A  16550  serial
  298.        port  chip  is  practically essential, as well as a (rela-
  299.        tively) fast cpu (a DX2/66 is plenty  fast  enough).   The
  300.        camera  supports     no  flow-control whatever, so the system
  301.        must be able to accept almost 1600 characters in a row  at
  302.        full  speed  without  losing any.  If timeouts are experi-
  303.        enced (indicating dropped characters),  try  lowering  the
  304.        initial    baud  rate, with the WinCamBaudRate configuration
  305.        variable, or the -s SPEED option.  (The -s option is  only
  306.        available  for  winc.   The  wincd and xwinc programs must
  307.        have the baud rate set via the variable.
  308.  
  309. MODEM OPERATION
  310.        A camera can be connected to a modem, and  can  be  called
  311.        using  a     second     modem on the local computer.  Aside from
  312.        the obvious physical connection differences, operation  is
  313.        almost  identical  to that of a directly connected camera.
  314.        The WinCamModemChat  variable  (see  CONFIGURATION  below)
  315.        should contain the full command line, including arguments,
  316.        for a command which will conduct     a  scripted  negotiation
  317.        with the modem.    The suggested command for this purpose is
  318.        known as "chat".     ("Chat" was originally written to estab-
  319.        lish  modem-based  PPP network connections, and is readily
  320.        available at many public ftp sites,  and     is  included  as
  321.        standard     in some Linux distributions.  Check the location
  322.        from which you retrieved the winc package -- there may  be
  323.        a  copy    of  chat  there.   See the chat man page for more
  324.        information on its usage.)
  325.  
  326. CONFIGURATION
  327.        winc will load configuration  information  from    the  file
  328.        $ETC/winc.rc. $ETC, for  those of  you who don't  know, is 
  329.        the  directory pointed  to by  the "SET ETC=" line in your 
  330.        config.sys file. This  pathname can be overridden with the
  331.        $WINC_RC environment  variable.    Currently,  the following
  332.        options may be set in winc.rc.    Note that any of them may
  333.        be overridden by setting an environment     variable of  the 
  334.        same name.  Numeric variables may be specified in decimal,
  335.        octal, or hex. Boolean on/off variables may be represented
  336.        as "on",  "off", "true", "false", "yes", "no", 1, or 0, or 
  337.        any appropriate substring.
  338.  
  339.        The following describes the format of the winc.rc file:
  340.  
  341.           Lines whose first non-whitespace character  is  '#'
  342.           are  skipped.   End-of-line  comments  are not sup-
  343.           ported.
  344.  
  345.           Whitespace  surrounding  the  '='     sign  itself  is
  346.           removed,    as  is whitespace at the end of the line.
  347.           Thus no values can ever begin or end in whitespace.
  348.  
  349.           No  other modifications are made to the value part;
  350.           that is, no quoting mechanisms are supported.
  351.  
  352.           Line continuations are not supported.
  353.  
  354.        The specific variables and their purpose are as follows:
  355.  
  356.        WinCamDevice
  357.           Specifies the tty device to  which  the  camera  is
  358.           attached.     Defaults to "COM2".
  359.  
  360.        WinCamBaudRate
  361.           Specifies     the baud rate at which winc should start
  362.           probing for the camera.  Successively  lower  rates
  363.           will  be    attempted  until  the  camera  is  found.
  364.           Defaults to 115200.
  365.  
  366.        WinCamLockFile
  367.           Not applicable to this OS/2 version.
  368.  
  369.        WinCamStopBits
  370.           The WinCam can be told to send extra "stop bits" on
  371.           every character, thus  slowing  it's  transmissions
  372.           fractionally.  Specifying more than 9 or 10 is bet-
  373.           ter  accomplished     by  lowering  the   baud   rate.
  374.           Default is 0.
  375.  
  376.        WinCamLineSync
  377.           When  taking  pictures  indoors  under  flourescent
  378.           lights, this will cause the camera  to  synchronize
  379.           its exposure to the 60hz (50hz in some places) line
  380.           frequency.  Default is on.
  381.  
  382.        WinCamSensitivity
  383.           A number from 0 to 15 which adjusts the sensitivity
  384.           of the camera's internal A/D converter.  Default is
  385.           15.
  386.  
  387.        WinCamImageClick
  388.           When the actual exposure command    is  sent  to  the
  389.           camera, an audible beep is produced.
  390.  
  391.        WinCamBrightness
  392.           A      number   between  1  and  99    representing  how
  393.           "brightly" the image should be exposed.    Different
  394.           scenes may need different values.     The default, for
  395.           reference, is 42.     Values between     40  and  60  are
  396.           suggested.
  397.  
  398.        WinCamColor
  399.           The  default  color  balance  setting,  used in the
  400.           absence of a -l option.  If this is  not    set,  the
  401.           value used is "(100,100,100)".
  402.  
  403.        WinCamGamma
  404.           The  default  gamma correction value, normalized to
  405.           100.   A    value  of  100    will  leave   the   image
  406.           unchanged.   Bigger  numbers  brighten, and smaller
  407.           numbers dim the image.  If  unset,  the  value  110
  408.           will be used.
  409.  
  410.        WinCamId
  411.           In  the absence of a -i option or existing environ-
  412.           ment variable, the WinCamId option  will    establish
  413.           the  default  camera  name.   See MULTIPLE CAMERAS,
  414.           below.
  415.  
  416. MULTIPLE CAMERAS
  417.        If you have more than one WinCam, you will need to  attach
  418.        each  to a separate serial port.     (Several WinCams techni-
  419.        cally have the capability to share a port, but  winc  does
  420.        not  support this feature.)  Each camera should be given a
  421.        name.  This name can be passed to winc on the command line
  422.        with  the  -i ID option.     The configuration for individual
  423.        cameras is done exactly as  listed  in  the  CONFIGURATION
  424.        section    above,    except    that  the configuration variables
  425.        listed there will have the camera's name prefixed  to  it.
  426.        So, if you have a camera named "fishtank", and invoke winc
  427.        with the "-i fishtank" option, then the    device    to  which
  428.        that  camera  is     attached should be defined in winc.rc as
  429.        "fishtankWinCamDevice = COM6", the     brightness  set-
  430.        ting  will  be defined as "fishtankWinCamBrightness = 40",
  431.        etc.
  432.  
  433.        The only variables which must be given independent  values
  434.        are  the name of the serial port (xxxWinCamDevice) and, if
  435.        more than one winc command may be active at a time for the
  436.        same  camera,  the  name     of the lock file (xxxWinCamLock-
  437.        File).  If a camera-specific variable does not exist for a
  438.        given  setting, then the non-camera specific variable will
  439.        be looked up.  So if most cameras share a baud  rate  set-
  440.        ting,  then  that  would still be set as "WinCamBaudRate".
  441.        The -i option translates to  the     value    of  the     WinCamId
  442.        variable.
  443.  
  444. EXAMPLE WINC.RC
  445.        Here is a sample winc configuration file, to show the fla-
  446.        vor of what one can  do.      Using     this  configuration  one
  447.        could  give commands to the "kitchen" camera without using
  448.        any -i option, and occasionally poll the camera    connected
  449.        to a remote modem by using "-i remote".
  450.  
  451.        #defaults for all cameras
  452.        WinCamBaudRate = 115200
  453.        WinCamLineSync = off
  454.        WinCamBrightness = 45
  455.  
  456.        # the default camera, if none is specified with "-i id" or in the environment
  457.        WinCamId = kitchen
  458.  
  459.        # the modem-connected camera
  460.        remoteWinCamDevice = COM1
  461.        remoteWinCamBaudRate = 38400
  462.        remoteWinCamModemChat = chat '' ATZ OK ATDT5551212 CONNECTED
  463.        remoteWinCamColor = sunlight
  464.  
  465.        # the kitchen camera
  466.        kitchenWinCamDevice = COM2
  467.        kitchenWinCamColor = flourescent
  468.        kitchenWinCamStarfield = c:\mptn\etc\winc_starfield_kitchen.pbm
  469.  
  470. COPYING and COPYRIGHT
  471.        This software is Copyright (C) 1996, by Paul G. Fox.  Spe-
  472.        cific image processing code  is    Copyright  (C)    1996,  by
  473.        StarDot Technologies.
  474.  
  475.        This  program  is  free    software; you can redistribute it
  476.        and/or modify it under the terms of the GNU General Public
  477.        License    as  published  by  the    Free Software Foundation;
  478.        either version 2 of the License, or (at your  option)  any
  479.        later version.
  480.  
  481.        This  program  is  distributed in the hope that it will be
  482.        useful, but WITHOUT ANY WARRANTY; without even the implied
  483.        warranty     of  MERCHANTABILITY  or FITNESS FOR A PARTICULAR
  484.        PURPOSE.     See the GNU  General  Public  License    for  more
  485.        details.
  486.  
  487.        You  should have received a copy of the GNU General Public
  488.        License along with this program; if not, write to the Free
  489.        Software     Foundation,  Inc.,  675  Mass Ave, Cambridge, MA
  490.        02139, USA.
  491.  
  492. DEBTS
  493.        winc was created with the help of proprietary  information
  494.        belonging  to  StarDot Technologies, makers of the WinCam.
  495.        Contact    them  at  help@wincam.com  for     information   on
  496.        obtaining a copy of that information.
  497.  
  498. AUTHORS
  499.        winc     was      created     by     Paul     G.     Fox,
  500.        pgf@foxharp.boston.ma.us.
  501.  
  502.        OS/2 port by Derek J Decker, derek@decker.net
  503.  
  504. BUGS
  505.        Oh well.
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.                                    10
  556.  
  557.  
  558.