World3DInput.H

Go to the documentation of this file.
00001 /*!@file Transport/World3DInput.H Simple 2d world  */
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: Lior Elazary <elazary@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Transport/World3DInput.H $
00035 // $Id: World3DInput.H 13115 2010-04-01 00:02:24Z lior $
00036 //
00037 
00038 #ifndef World3DInput_H_DEFINED
00039 #define World3DInput_H_DEFINED
00040 
00041 #include "Transport/FrameIstream.H"
00042 #include "Image/Image.H"
00043 #include "Image/Pixels.H"
00044 #include "Image/Point3D.H"
00045 #include "Image/Point2D.H"
00046 #include "GUI/ViewPort3D.H"
00047 #include "Raster/GenericFrame.H"
00048 
00049 class World3DInput : public FrameIstream
00050 {
00051 public:
00052 
00053 
00054   struct Object
00055   {
00056     enum ObjectType {BOX, CYLINDER, SPHERE};
00057     ObjectType type;
00058     Point3D<float> pos;
00059     Point3D<float> rotation;
00060     Point3D<float> color;
00061     Point3D<float> params;
00062     Object() {}
00063 
00064     Object(const ObjectType t,
00065         const Point3D<float>& p,
00066         const Point3D<float>& r,
00067         const Point3D<float>& c,
00068         const Point3D<float>& s) :
00069       type(t), pos(p), rotation(r), color(c), params(s)
00070     {}
00071   };
00072 
00073   struct ObjectsData : public GenericFrame::MetaData
00074   {
00075     std::vector<Object> objects;
00076   };
00077 
00078   //Constructor
00079   World3DInput(OptionManager& mgr);
00080   ~World3DInput();
00081 
00082 
00083   //! Override from FrameIstream; just calls setDims()
00084   virtual void setConfigInfo(const std::string& dimsstring);
00085 
00086   //! Peek at the specifications of the next frame to be read
00087   virtual GenericFrameSpec peekFrameSpec();
00088 
00089   //! Generate the world
00090   virtual GenericFrame readFrame();
00091 
00092   //! Specify the dimensions of the image to the world
00093   void setImageDims(const Dims& s);
00094 
00095   void drawWheelAndBolts(bool rightSide);
00096   void drawCar();
00097 
00098 
00099   Image<PixRGB<byte> > getImage();
00100   void generateWorld();
00101 
00102 private:
00103 
00104   ViewPort3D* itsViewPort;
00105   std::vector<Object> itsObjects;
00106 
00107   Dims itsImageDims;
00108   Image<PixRGB<byte> > itsWorldImg;
00109   Point2D<int> itsCurrentPos;
00110   int itsFrame;
00111 
00112 };
00113 
00114 #endif
00115 
00116 // ######################################################################
00117 /* So things look consistent in everyone's emacs... */
00118 /* Local Variables: */
00119 /* indent-tabs-mode: nil */
00120 /* End: */
Generated on Sun May 8 08:42:24 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3