LoVideoRecorder.H

00001 /**
00002    \file Robots/LoBot/LoVideoRecorder.H
00003 
00004    \brief Video recorder encapsulation for the Lobot/Robolocust project.
00005 
00006    This file defines the lobot::VideoRecorder class, which is used to
00007    record input video streams to MPEG movies. This class uses the INVT
00008    ffmpeg encoder to do its thing.
00009 
00010    The idea here is to be able to drive our robot around and have it
00011    record movies using its camera inputs. We can then send these movies
00012    to the Gabbiani team at the Baylor College of Medicine (Houston, TX)
00013    and have them show these movies to actual locusts and send us back the
00014    LGMD spike train recordings, which we can use to better test our
00015    integration algorithms.
00016 */
00017 
00018 // //////////////////////////////////////////////////////////////////// //
00019 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00020 // by the University of Southern California (USC) and the iLab at USC.  //
00021 // See http://iLab.usc.edu for information about this project.          //
00022 // //////////////////////////////////////////////////////////////////// //
00023 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00024 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00025 // in Visual Environments, and Applications'' by Christof Koch and      //
00026 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00027 // pending; application number 09/912,225 filed July 23, 2001; see      //
00028 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00029 // //////////////////////////////////////////////////////////////////// //
00030 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00031 //                                                                      //
00032 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00033 // redistribute it and/or modify it under the terms of the GNU General  //
00034 // Public License as published by the Free Software Foundation; either  //
00035 // version 2 of the License, or (at your option) any later version.     //
00036 //                                                                      //
00037 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00038 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00039 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00040 // PURPOSE.  See the GNU General Public License for more details.       //
00041 //                                                                      //
00042 // You should have received a copy of the GNU General Public License    //
00043 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00044 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00045 // Boston, MA 02111-1307 USA.                                           //
00046 // //////////////////////////////////////////////////////////////////// //
00047 //
00048 // Primary maintainer for this file: Manu Viswanathan <mviswana at usc dot edu>
00049 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/io/LoVideoRecorder.H $
00050 // $Id: LoVideoRecorder.H 12785 2010-02-06 02:24:05Z irock $
00051 //
00052 
00053 #ifndef LOBOT_VIDEO_RECORDER_DOT_H
00054 #define LOBOT_VIDEO_RECORDER_DOT_H
00055 
00056 //------------------------------ HEADERS --------------------------------
00057 
00058 // lobot headers
00059 #include "Robots/LoBot/io/LoVideoStream.H"
00060 
00061 // INVT MPEG encoding support
00062 //
00063 // DEVNOTE: Unfortunately, INVT's FfmpegEncoder class doesn't have a
00064 // "default" definition in case the FFmpeg libraries are missing. We
00065 // work around that here by supplying a fake FfmpegEncoder class so that
00066 // lobot builds succeed.
00067 #ifdef INVT_HAVE_AVCODEC // FFmpeg libs available
00068 
00069 #include "Media/FfmpegEncoder.H" // use INVT's MPEG encoding support
00070 
00071 #else // FFmpeg libs not available
00072 
00073 struct FfmpegEncoder {} ; // fake MPEG encoder to allow builds
00074 
00075 #endif // #ifdef INV_HAVE_AVCODEC
00076 
00077 // Standard C++ headers
00078 #include <string>
00079 
00080 //----------------------------- NAMESPACE -------------------------------
00081 
00082 namespace lobot {
00083 
00084 //------------------------- CLASS DEFINITION ----------------------------
00085 
00086 /**
00087    \class lobot::VideoRecorder
00088    \brief Video stream recorder for Lobot/Robolocust project.
00089 
00090    This class wraps around INVT's FfmpegEncoder in order to send input
00091    video streams to an MPEG file. This is useful for exchanging movies of
00092    our robot moving with the Gabbiani team at Baylor so as to get back
00093    LGMD spike trains from them.
00094 */
00095 class VideoRecorder {
00096    // The recorder gets its input from a video stream (which can be
00097    // reading either from a IEEE-1394 camera or an MPEG file) and sends
00098    // the incoming frames to an MPEG file using the INVT FfmpegEncoder
00099    // class.
00100    const VideoStream* m_source ;
00101    FfmpegEncoder      m_sink ;
00102 
00103    // Prevent copy and assignment
00104    VideoRecorder(const VideoRecorder&) ;
00105    VideoRecorder& operator=(const VideoRecorder&) ;
00106 
00107 public:
00108    /// This constructor sets up a recorder to read input images from the
00109    /// provided video stream and store them in an MPEG file with the
00110    /// given "root" name. The file name extension is appended
00111    /// automatically (by FfmpegEncoder).
00112    VideoRecorder(const std::string& mpeg_name, const VideoStream*) ;
00113 
00114    /// This method reads the current frame from its video stream source
00115    /// and writes it to the MPEG file the recorder is recording to.
00116    void update() ;
00117 
00118    /// Clean-up
00119    ~VideoRecorder() ;
00120 } ;
00121 
00122 //-----------------------------------------------------------------------
00123 
00124 } // end of namespace encapsulating this file's definitions
00125 
00126 #endif
00127 
00128 /* So things look consistent in everyone's emacs... */
00129 /* Local Variables: */
00130 /* indent-tabs-mode: nil */
00131 /* End: */
Generated on Sun May 8 08:41:30 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3