00001 /*!@file Raster/YuvParser.H Parse raw YUV image files. */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // 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@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Raster/YuvParser.H $ 00035 // $Id: YuvParser.H 9201 2008-02-01 17:45:38Z rjpeters $ 00036 // 00037 00038 #ifndef YUVPARSER_H_DEFINED 00039 #define YUVPARSER_H_DEFINED 00040 00041 #include "Raster/RasterParser.H" 00042 00043 #include <string> 00044 00045 // ###################################################################### 00046 //! This class handles reading/parsing of RASFMT_RAW_VIDEO image files. 00047 class YuvParser : public RasterParser 00048 { 00049 public: 00050 //! Construct with a filename, and use the current default Dims setting. 00051 /*! The exact Dims and VideoFormat of the resulting frame is 00052 inferred from the filename extension, which should be of the 00053 form ".WWWxHHH.PIXFMT", where WWW and HHH are the image 00054 dimensions and PIXFMT is e.g. "yuv420p" for VIDFMT_YUV420P. For 00055 backward-compatibility, the image dimensions may be omitted 00056 (though this is discouraged), in which case the dimensions are 00057 taken to be the current value of getDefaultDims(); the initial 00058 default Dims value is 640x480. */ 00059 YuvParser(const char* fname); 00060 00061 //! Destructor. 00062 virtual ~YuvParser(); 00063 00064 //! Specify a new default Dims value. 00065 /*! This will be the Dims that are used if a YuvParser is 00066 constructed with no Dims specification. */ 00067 static void setDefaultDims(const Dims& d); 00068 00069 //! Get the current default Dims value. 00070 /*! The initial default Dims is 640x480. */ 00071 static Dims getDefaultDims(); 00072 00073 //! Whether to pass strictLength=true when calling VideoFrame::fromFile() 00074 static void setStrictDims(bool v); 00075 00076 //! Get the current strict dims setting 00077 static bool getStrictDims(); 00078 00079 //! Get the specifications of the image without fully reading it 00080 virtual GenericFrameSpec getFrameSpec() const; 00081 00082 //! Get the comments from the image without fully reading it 00083 virtual std::string getComments() const; 00084 00085 //! Get image tags if the image supports them 00086 virtual uint getTagCount() const; 00087 00088 //! Get image tags if the image supports them 00089 virtual bool getTag(uint tag, std::string &name, std::string &value) const; 00090 00091 //! Get a GenericFrame representation from the raster file. 00092 /*! This can subsequently be converted to rgb, grayscale, 00093 floating-point, or video-yuv. */ 00094 virtual GenericFrame getFrame(); 00095 00096 private: 00097 YuvParser(const YuvParser&); 00098 YuvParser& operator=(const YuvParser&); 00099 00100 struct Rep; 00101 Rep* const rep; 00102 }; 00103 00104 #endif // !YUVPARSER_H_DEFINED