// Approx2D.h -- Analysis of 2D Mondrian scenes. Takes photogtaphs as input. // // // DESCRIPTION // // Copyright © Timothy Bahls, Daniel Scharstien 2004. // /////////////////////////////////////////////////////////////////////////// // unknown float value #define UNKNOWN -9876 #define UNKNOWNF -9876.5f #define MAX 1234.5f #define MIN -1234.5f #ifndef WIN32 #define __max(a,b) (((a) > (b)) ? (a) : (b)) #define __min(a,b) (((a) < (b)) ? (a) : (b)) #endif #include "Color.h" class CPhotoAnalysis; class CRegPhotoAnalysis { public: int id; // its own index int nFrames; int maxVelocity; int minVelocity; int*maxVelData; int*minVelData; float minVelGuess; float maxVelGuess; float minLen; float maxLen; float*minmin; float*maxmin; float*minmax; float*maxmax; // constructor CRegPhotoAnalysis(int id, const CPhotoAnalysis * master); CRegPhotoAnalysis(){} //default void deleteOld(); bool operator == (CRegPhotoAnalysis); void limitV(int f1, int f2, float*minA, float*maxA); void limitP(int f1, int f2, float*&minA, float*&maxA); void restrictVel(); void restrictLen(); void restrictPosition(); void velLessThan(float max, int odds); void velMoreThan(float min, int odds); void guessVelocity(); }; // all regions class CPhotoAnalysis { int nRegions; // number of regions observed so far int maxWidth; //length of image int maxID; //float**edgeVels;//the velocities of edges, including hypothetical. int**relative;//the relative distances int**data;//the reduced image CRegPhotoAnalysis* region; CByteImage im; CRegPhotoAnalysis null; CCol * colTable; int times; public: int minVelocity; int maxVelocity; int nFrames; // number of frames (used for iteration) // constructor and destructor CPhotoAnalysis(int nFrames,bool iverbose); CPhotoAnalysis(){} //default ~CPhotoAnalysis(); int goGoGo(CByteImage*imgs, bool stereo, int minVelocity, int maxVelocity); void readFrame(CByteImage im,int frame,int row); void reportResults(); bool verbose; private: // prototypes int compare(int a, int b);//check to see if a is likely closer than b void p(int a); //print the description of the color at colTable[a] void setCloser(int c, int f, int odds);//c probably closer f with likelyhood odds void addid(int a); //new id seen int getPixID(int row, int col);//find color in im at row,col int colToID(CCol c); //find where in the colTable c goes. void analyzeT(int row, int col, int id1, int id2, int id3); //checks four by four box around a two by two T junction void checkForT(int row, int col, int displace);//looks for two by two T junctions void startRegion(int id, int frame, int x, int prevId); void endRegion(int id, int frame, int x, int nextId); void transitiveClosure(); void occlusionDetection(); void extendedT(); void possibilityElimination(); void stereoRestriction(); };