HashOutputSeries.H

Go to the documentation of this file.
00001 /*!@file Transport/HashOutputSeries.H write a series of image hashes 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/HashOutputSeries.H $
00035 // $Id: HashOutputSeries.H 9547 2008-03-28 23:32:43Z rjpeters $
00036 //
00037 
00038 #ifndef TRANSPORT_HASHOUTPUTSERIES_H_DEFINED
00039 #define TRANSPORT_HASHOUTPUTSERIES_H_DEFINED
00040 
00041 #include "Transport/FrameOstream.H"
00042 
00043 //! FrameOstream subclass that writes image hashes to an output file
00044 /*! To try out HashOutputSeries, you can for example do the following
00045     using bin/stream to generate a listing on stderr of 100 32-bit
00046     hashes of 300x300 random images like this:
00047 
00048       ./bin/stream --in=random:300x300 --in-echo=hash:stderr \
00049                    --input-frames=0-99@1
00050 
00051     which will generate output like the following:
00052 
00053       000000  5b380a30  0  % input-echo
00054       000001  1d108dc8  0  % input-echo
00055       000002  5c0e58aa  0  % input-echo
00056       000003  cb34047b  0  % input-echo
00057       000004  f800c826  0  % input-echo
00058       000005  6386062a  0  % input-echo
00059       000006  30ed69d6  0  % input-echo
00060 
00061     where the first column is the frame number, the second column is
00062     the hash, and the third column is a 0 or 1 indicating whether
00063     we've seen that hash value previously in this run -- note that a
00064     value of 1 doesn't necessarily imply a hash-function collision; it
00065     could be that the input frames were exactly the same! The last
00066     column, after a matlab-comment character (%), is the image name as
00067     it was passed to writeRGB() or writeGray() or writeFloat().
00068 
00069     If the filename given to HashOutputSeries is "", "-", "stdout", or
00070     "STDOUT" then the output goes to stdout, likewise "stderr" or
00071     "STDERR" sends output to stderr, and anything else will be
00072     interpreted as a literal filename to which output should be
00073     written.
00074 */
00075 class HashOutputSeries : public FrameOstream
00076 {
00077 public:
00078   //! Constructor
00079   HashOutputSeries(OptionManager& mgr);
00080 
00081   //! Destructor
00082   virtual ~HashOutputSeries();
00083 
00084   //! Override from FrameOstream; just calls setFileName()
00085   virtual void setConfigInfo(const std::string& filename);
00086 
00087   //! Set the current frame number and remember it
00088   virtual bool setFrameNumber(int n);
00089 
00090   //! Write a image hash to the output file
00091   virtual void writeFrame(const GenericFrame& frame,
00092                           const std::string& shortname,
00093                           const FrameInfo& auxinfo);
00094 
00095   //! No-op
00096   virtual void closeStream(const std::string& shortname);
00097 
00098   //! Specify the output filename
00099   void setFileName(const std::string& s);
00100 
00101 private:
00102   HashOutputSeries(const HashOutputSeries&);
00103   HashOutputSeries& operator=(const HashOutputSeries&);
00104 
00105   struct Impl;
00106   Impl* rep;
00107 };
00108 
00109 // ######################################################################
00110 /* So things look consistent in everyone's emacs... */
00111 /* Local Variables: */
00112 /* indent-tabs-mode: nil */
00113 /* End: */
00114 
00115 #endif // TRANSPORT_HASHOUTPUTSERIES_H_DEFINED
Generated on Sun May 8 08:06:57 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3