Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

SfBandStereoDev.h

00001 //
00002 // SfBandStereoDev.h
00003 //
00004 // Saphira band stereo device class defs
00005 
00006 //
00007 // Copyright 2001 by Kurt Konolige
00008 //
00009 // The author hereby grants to SRI permission to use this software.
00010 // The author also grants to SRI permission to distribute this software
00011 // to schools for non-commercial educational use only.
00012 //
00013 // The author hereby grants to other individuals or organizations
00014 // permission to use this software for non-commercial
00015 // educational use only.  This software may not be distributed to others
00016 // except by SRI, under the conditions above.
00017 //
00018 // Other than these cases, no part of this software may be used or
00019 // distributed without written permission of the author.
00020 //
00021 // Neither the author nor SRI make any representations about the 
00022 // suitability of this software for any purpose.  It is provided 
00023 // "as is" without express or implied warranty.
00024 //
00025 // Kurt Konolige
00026 // Senior Computer Scientist
00027 // SRI International
00028 // 333 Ravenswood Avenue
00029 // Menlo Park, CA 94025
00030 // E-mail:  konolige@ai.sri.com
00031 
00032 
00033 #ifndef SFBANDSTEREODEV_H
00034 #define SFBANDSTEREODEV_H
00035 
00036 #undef SFEXPORT
00037 #if defined(MS_WINDOWS) && !defined(SF_STATIC)
00038 #ifdef MAKE_LIBRARY
00039 #define _declspec( dllexport )
00040 #else
00041 #define _declspec( dllimport )
00042 #endif
00043 #else
00044 #define SFEXPORT
00045 #endif
00046 
00047 
00048 //
00049 // SfBandStereoDevice
00050 // Creates an ArSonarDevice and incorporates it
00051 //
00052 
00053 class SfBandStereoDevice : public SfRangeDevice
00054 {
00055 public:
00056   SfBandStereoDevice(ArPose spose, int curBufSize, 
00057                               int maxRange = 5000);
00058   ~SfBandStereoDevice();
00059   // starts up the device with .ini file
00060   // if fname is present, uses file images; else hardware device
00061   bool start(char *ini, char *fname = NULL); 
00062   bool stop();          // shuts down the device
00063   void request() { myRequest = true; }  // request a new reading
00064   void draw(SfWin *);
00065   void process();               // what we do 
00066   void addAccum();              // adds readings into the accum buffer
00067   void clearAccum();            // clears the accum buffer
00068 
00069 protected:                      
00070   // this will get called as a sync task using process(), look at the constructor
00071   ArFunctorC<SfBandStereoDevice> myBandStereoTask;
00072 
00073   // buffers
00074   int myCurBufSize, myCumBufSize, myMaxRange;
00075   std::list<ArSensorReading *> *myRawReadings;
00076   ArPose mySensorPose;
00077   void setRawBuffers();         // set raw buffer reading parameters
00078   int cellWidth, cellHeight;    // band cell size
00079 
00080   // SVS objects
00081   svsAcquireImages *sourceObject; // source of images
00082   svsStereoProcess *processObject; // for computing disparity image
00083   bool calcCellDist(int x, int y, svsStereoImage *si, int *sx, int *sy); // distance to a cell
00084   void filterReadings();        // filter out long range readings
00085   double myFilterNearDist;      // how near two readings can be in current buffer
00086   double myFilterFarDist;       // how far away is too far in current buffer
00087 
00088   // request a new stereo image
00089   bool myRequest;
00090 
00091 };
00092 
00093 
00094 
00095 #endif // SFBANDSTEREODEV_H

Generated on Tue Nov 12 17:49:33 2002 for Saphira by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001