00001 #ifndef Impala_Core_Geometry_MaskedInterestPointSelector_h 00002 #define Impala_Core_Geometry_MaskedInterestPointSelector_h 00003 00004 #include "Core/Geometry/InterestPointList.h" 00005 #include "Core/Array/Arrays.h" 00006 00007 namespace Impala 00008 { 00009 namespace Core 00010 { 00011 namespace Geometry 00012 { 00013 00014 00015 class MaskedInterestPointSelector : public InterestPointSelector 00016 { 00017 public: 00018 00019 MaskedInterestPointSelector(Array::Array2dScalarInt32* pointList, int index) 00020 : mPointList(pointList), mIndex(index+2) 00021 { 00022 mIter = 0; 00023 } 00024 00025 bool 00026 Accept(int x, int y, int imageWidth, int imageHeight) 00027 { 00028 bool restarted = false; 00029 while(true) 00030 { 00031 if(mIter >= mPointList->CH()) 00032 { 00033 if(restarted) break; 00034 restarted = true; 00035 mIter = 0; 00036 } 00037 if((x == mPointList->Value(0,mIter)) && (y == mPointList->Value(1,mIter))) 00038 { 00039 // found it 00040 Int32 value = mPointList->Value(mIndex,mIter); 00041 if(value) return true; 00042 return false; 00043 } 00044 mIter++; 00045 } 00046 ILOG_VAR(Impala.Core.Geometry.MaskedInterestPointSelector); 00047 ILOG_WARN("not found: " << x << " " << y); 00048 return false; 00049 } 00050 private: 00051 Array::Array2dScalarInt32* mPointList; 00052 int mIndex; 00053 int mIter; 00054 }; 00055 00056 00057 } // namespace Geometry 00058 } // namespace Core 00059 } // namespace Impala 00060 00061 #endif