template<class ArrayT>
Definition at line 16 of file LocalMinMax.h. References SetVal(). 00017 { 00018 ArrayT* res=ArrayClone<ArrayT,ArrayT>(src); 00019 SetVal(res,0); 00020 for(int i=BW;i<src->CW()-BW;i++) 00021 { 00022 for(int j=BH;j<src->CH()-BH;j++) 00023 { 00024 bool IsMax=true; 00025 bool IsMin=true; 00026 00027 for(int k=-BW;k<=BW;k++) 00028 { 00029 for(int l=-BH;l<=BH;l++) 00030 { 00031 if((l==0)&&(k==0)) 00032 continue; 00033 if(!(src->Value(i,j)>src->Value(i+k,j+l))){ 00034 IsMax=false; 00035 break; 00036 } 00037 } 00038 if(!IsMax) 00039 break; 00040 } 00041 if(IsMax) 00042 { 00043 if(ReplaceValue) 00044 res->SetValue(src->Value(i,j),i,j); 00045 else 00046 res->SetValue(1,i,j); 00047 } 00048 00049 for(int k=-BW;k<=BW;k++) 00050 { 00051 for(int l=-BH;l<=BH;l++) 00052 { 00053 if((l==0)&&(k==0)) 00054 continue; 00055 if(!(src->Value(i,j)<src->Value(i+k,j+l))){ 00056 IsMin=false; 00057 break; 00058 } 00059 } 00060 if(!IsMin) 00061 break; 00062 } 00063 if(IsMin) 00064 { 00065 if(ReplaceValue) 00066 res->SetValue(src->Value(i,j),i,j); 00067 else 00068 res->SetValue(-1,i,j); 00069 } 00070 } 00071 00072 } 00073 return res; 00074 }
Here is the call graph for this function:
|