www.pudn.com > imageFeatures_Ver3_0_source.zip > IFLocation.h
// IFLocation.h /* ** Copyright (C) 1994, 2003 Tyler C. Folsom ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all copies and that both that ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. */ #ifndef IFLOCATION_H #define IFLOCATION_H #include// Specifies a location at which to apply filters to the image. // At each location, apply four filter sets: // small odd, small even, big odd, big even. // CLocation also holds the results of applying the filters. // It supports methods to find the feature angle, // and to steer the filters to this angle. class CLocation { public: // constructor specifying (x,y) sampling location and // smaller filter diameter. Numbers are in pixels. CLocation( int x = 0, int y = 0, int diam = 0 ); // Change the sampling location and filter diameter. void Initialize( int x, int y, int diam ); // copy constructor CLocation(const CLocation &right); // assignment const CLocation &operator=( const CLocation &right ); // if input is true, accessor refer to the smaller filter; // if false, use the larger filter. void SetSmall( bool useSmall) { m_usingSmall = useSmall; } // return diameter of small or big filter. const int GetDiam() { return (m_usingSmall? m_diam: m_big_diam); } // return filter location and diameter of small filter int GetLocation( int *x, int *y) { *x = m_x_rf; *y = m_y_rf; return m_diam; } // if input is true, accessor refer to the odd filter; // if false, use the even filter. void SetOdd( bool useOdd) { m_usingOdd = useOdd; } // store correlation "result" in slot n of even/odd big/small filter void SetResult( int n, float result); // return correlation from slot n of even/odd big/small filter float GetResult( int n); // returns a rectangle defining the subimage of the location RECT GetRect(); // Returns the angle (radians) of the feature based on filter correlations float GetAngle( float *dom_resp, // squared magnitude of response float *steeredEven, // small even filters steered to angle float *steeredOdd, // small odd filters steered to angle bool noSteering); // no steering if true // Steer a filter type to the indicated angle (radians) float Steer( float angle ); float GetStrengthBound(); // returns an upper bound on the strength private: inline void Copy(const CLocation &right); float steer_60( CArray & sampled, float theta); float steer_45( CArray & sampled, float theta); inline float steer_90( CArray & sampled, float theta); void solve( float *sampled, float *theta, float (*deriv)(float *, float)); float solve_max( float *sampled, float *theta, float (*trig)(float *, float, float *, float *)); int m_x_rf; /* x coordinate of receptive field center (pixels). */ int m_y_rf; /* y coordinate of receptive field center. */ bool m_usingSmall; bool m_usingOdd; int m_diam; /* diameter of small receptive field (pixels) */ // results of correlating an image patch with even filter CArray corrEven; // aka G2 // results of correlating an image patch with odd filter CArray corrOdd; // aka H2 int m_big_diam; /* diameter of big receptive field (pixels) */ // results of correlating an image patch with even filter CArray corrBigEven; // big G2 // results of correlating an image patch with odd filter CArray corrBigOdd; // big H2 }; #endif // IFLOCATION_H