Definition at line 183 of file Octaves.h. References Impala::Core::Array::GaussDerivative(), ILOG_INFO, Impala::Core::Geometry::LINEAR, max, min, mLevels, mOctaveArray, mOctaves, mRecGauss, mRecursive, mResample, mScales, mSigmaK, mSigmas, mSrcArray, mSrcScalar, Impala::Core::Geometry::NEAREST, Impala::Core::Array::PixMinMax(), Impala::Core::Array::RecGauss(), Impala::Core::Array::Scale(), and Impala::Core::Array::Set(). Referenced by Init(). 00183 { 00185 //Calculate sigmas for the first levels of each octave 00186 //Each sigma is double its counterpart in the octave below 00187 // 00188 //This was 0.5 before, for prior smoothing 00189 mSigmas[0] = 1; 00190 00191 for(int o=1;o<mOctaves;o++) 00192 { 00193 mSigmas[o*mScales] = 2 * mSigmas[(o-1)*mScales]; 00194 } 00195 00197 //mSigmaK is the ratio of sigmas between successive levels 00198 mSigmaK = powf(2.0,1.0/mLevels); 00199 00201 //Calculate the sigma values of other levels. 00202 //Depending on the number of levels in each octave, we divide the sigmas 00203 //logarithmically, each scaled by 2^(1/mLevels) 00204 for(int o=0;o<mOctaves;o++){ 00205 std::ostringstream oss; 00206 oss<<"Octave "<<o<<" :"; 00207 for(int l=0;l<mScales;l++) 00208 { 00209 mSigmas[o*mScales+l] = mSigmas[o*mScales] * powf(mSigmaK,l); 00210 oss<<" "<< mSigmas[o*mScales+l]; 00211 } 00212 ILOG_INFO(oss.str()); 00213 } 00214 00216 //Calculate the gaussian smoothed versions of the image, 00217 //given the sigma values for each level 00218 for(int o=0;o<mOctaves;o++) 00219 { 00220 //Calculate the initial image, 00221 00222 //If it's not the first octave, the image is resampled from 2*sigma 00223 //of above octaves first level. 00224 if(mResample) 00225 { 00226 if((o==0)) 00227 { 00228 //The first array is the linear upsampling of the original 00229 mSrcArray[o] = 0; 00230 Scale(mSrcArray[o], mSrcScalar,2,2,Geometry::LINEAR); 00231 00232 }else{ 00233 //resample the scale that has double the sigma of 00234 //previous octave's first scale 00235 Array2dScalarReal64* src=mOctaveArray[(o-1)*mScales+mLevels]; 00236 mSrcArray[o] = 0; 00237 Scale(mSrcArray[o],src,.5,.5,Geometry::NEAREST); 00238 } 00239 } 00240 else 00241 { 00243 //Don't resample the image from source, use directly 00244 //This causes all the analysis to be done in the same resolution 00245 if(o==0){ 00246 mSrcArray[o] = 0; 00247 Set(mSrcArray[o], mSrcScalar); 00248 }else{ 00249 mSrcArray[o] = 0; 00250 Set(mSrcArray[o],mOctaveArray[(o-1)*mScales+mLevels]); 00251 } 00252 00253 } 00255 //The source image for this octave is ready 00256 //Do any prior smoothing 00257 00258 00259 for(int l=0;l<mScales;l++) 00260 { 00261 //ILOG_DEBUG("Octave "<<o<<" Level "<<l<<" Src:"<<mSrcArray[o]); 00262 if(mRecGauss) 00263 { 00264 if(mRecursive) 00265 { 00266 //Calculate each gaussian smoothing recursively 00267 Array2dScalarReal64* src; 00269 //If it's the first level in the octave, 00270 //we should use the array we calculated in the previous 00271 //step, else we use the previous level in the octave 00272 if(l==0) 00273 src = mSrcArray[o]; 00274 else 00275 src = mOctaveArray[o*mScales+l-1]; 00276 00277 RecGauss(mOctaveArray[o*mScales+l], 00278 src, 00279 mSigmaK, 00280 mSigmaK,0,0,3); 00281 }else{ 00282 //Calculate each gaussian smoothing directly using 00283 //recursive gauss 00284 RecGauss(mOctaveArray[o*mScales+l], 00285 mSrcArray[o], 00286 mSigmas[l], 00287 mSigmas[l], 00288 0,0,3); 00289 00290 } 00291 } 00292 else 00293 { 00294 if(mRecursive) 00295 { 00296 Array2dScalarReal64* src; 00297 if(l==0) 00298 src = mSrcArray[o]; 00299 else 00300 src = mOctaveArray[o*mScales+l-1]; 00301 00302 GaussDerivative(mOctaveArray[o*mScales+l], 00303 src, 00304 mSigmaK,0,0,3); 00305 00306 }else{ 00307 GaussDerivative(mOctaveArray[o*mScales+l], 00308 mSrcArray[o], 00309 mSigmas[l], 00310 0,0,3); 00311 } 00312 } 00313 Real64 min=0; 00314 Real64 max=0; 00315 PixMinMax(mOctaveArray[o*mScales+l],&min,&max); 00316 //ILOG_DEBUG("Gaussian @ "<<o<<"x"<<l<<" : ("<<min<<","<<max<<")"); 00317 } 00318 } 00319 }
Here is the call graph for this function:
|