StatsOutputSeries.H

Go to the documentation of this file.
00001 /*!@file Transport/StatsOutputSeries.H FrameOstream subclass that writes image statistics to an output file */
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: Rob Peters <rjpeters at usc dot edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Transport/StatsOutputSeries.H $
00035 // $Id: StatsOutputSeries.H 9547 2008-03-28 23:32:43Z rjpeters $
00036 //
00037 
00038 #ifndef TRANSPORT_STATSOUTPUTSERIES_H_DEFINED
00039 #define TRANSPORT_STATSOUTPUTSERIES_H_DEFINED
00040 
00041 #include "Transport/FrameOstream.H"
00042 
00043 //! FrameOstream subclass that writes image statistics to an output file
00044 /*! To try out StatsOutputSeries, you can for example do the following
00045     using bin/stream to generate a listing on stderr of basic
00046     statistics for 5 random 300x300 color images:
00047 
00048       ./bin/stream --in=random:300x300 --out=stats:stderr \
00049                    --input-frames=0-4@1
00050 
00051     which will generate output like the following:
00052 
00053     000000 R=[0 .. 127.419667 +/- 73.714227 .. 255] G=[0 .. 127.312844 +/- 73.822887 .. 255] B=[0 .. 127.575222 +/- 73.854606 .. 255] % stream-output (300x300 Image<PixRGB<byte>>)
00054     000001 R=[0 .. 127.491533 +/- 73.670695 .. 255] G=[0 .. 127.532900 +/- 74.127892 .. 255] B=[0 .. 127.387644 +/- 73.752754 .. 255] % stream-output (300x300 Image<PixRGB<byte>>)
00055     000002 R=[0 .. 127.553444 +/- 74.032009 .. 255] G=[0 .. 127.531078 +/- 73.875733 .. 255] B=[0 .. 127.660456 +/- 73.902850 .. 255] % stream-output (300x300 Image<PixRGB<byte>>)
00056     000003 R=[0 .. 127.584222 +/- 73.662192 .. 255] G=[0 .. 127.564222 +/- 74.022741 .. 255] B=[0 .. 127.547267 +/- 73.920700 .. 255] % stream-output (300x300 Image<PixRGB<byte>>)
00057     000004 R=[0 .. 127.425100 +/- 73.940624 .. 255] G=[0 .. 127.340178 +/- 73.798693 .. 255] B=[0 .. 127.278911 +/- 73.749278 .. 255] % stream-output (300x300 Image<PixRGB<byte>>)
00058     OVERALL R=[0 .. 127.494793 .. 255] G=[0 .. 127.456244 .. 255] B=[0 .. 127.489900 .. 255] % summary of 5 frames
00059 
00060     where the first column is the frame number, followed by
00061 
00062     [min .. mean +/- stdev .. max]
00063 
00064     for each of the R,G,B components. The final line gives
00065 
00066     [min .. mean .. max]
00067 
00068     over all of the input frames.
00069 
00070     If the filename given to StatsOutputSeries is "", "-", "stdout", or
00071     "STDOUT" then the output goes to stdout, likewise "stderr" or
00072     "STDERR" sends output to stderr, and anything else will be
00073     interpreted as a literal filename to which output should be
00074     written.
00075 */
00076 class StatsOutputSeries : public FrameOstream
00077 {
00078 public:
00079   //! Constructor
00080   StatsOutputSeries(OptionManager& mgr);
00081 
00082   //! Destructor
00083   virtual ~StatsOutputSeries();
00084 
00085   //! Override from FrameOstream; just calls setFileName()
00086   virtual void setConfigInfo(const std::string& filename);
00087 
00088   //! Set the current frame number and remember it
00089   virtual bool setFrameNumber(int n);
00090 
00091   //! Write image statistics to the output file
00092   virtual void writeFrame(const GenericFrame& frame,
00093                           const std::string& shortname,
00094                           const FrameInfo& auxinfo);
00095 
00096   //! No-op
00097   virtual void closeStream(const std::string& shortname);
00098 
00099   //! Specify the output filename
00100   void setFileName(const std::string& s);
00101 
00102 private:
00103   virtual void stop2();
00104 
00105   StatsOutputSeries(const StatsOutputSeries&);
00106   StatsOutputSeries& operator=(const StatsOutputSeries&);
00107 
00108   struct Impl;
00109   Impl* rep;
00110 };
00111 
00112 // ######################################################################
00113 /* So things look consistent in everyone's emacs... */
00114 /* Local Variables: */
00115 /* mode: c++ */
00116 /* indent-tabs-mode: nil */
00117 /* End: */
00118 
00119 #endif // TRANSPORT_STATSOUTPUTSERIES_H_DEFINED
Generated on Sun May 8 08:06:57 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3