template<int INDEX_SIZE, int ORI_SIZE>
Definition at line 199 of file KoenFIST2.h. References Impala::Core::Feature::FISTDescriptor< INDEX_SIZE, ORI_SIZE >::InternalCount(). Referenced by Impala::Core::Feature::FISTDescriptor< INDEX_SIZE, ORI_SIZE >::SamplePoint(). 00202 { 00203 Real64 rpos, cpos, rx, cx; 00204 00205 // integer version of the patch center position (in image coordinates) 00206 int irow = (int) (row + 0.5); 00207 int icol = (int) (col + 0.5); 00208 Real64 sinus = sin(pointOrientation); 00209 Real64 cosinus = cos(pointOrientation); 00210 00211 /* The spacing of index samples in terms of pixels at this scale. */ 00212 const int magnificationFactor = 3; 00213 Real64 spacing = scale * magnificationFactor; 00214 00215 /* Radius of index sample region must extend to diagonal corner of 00216 index patch plus half sample for interpolation. 00217 */ 00218 Real64 radius = 1.414 * spacing * INDEX_SIZE / 2.0; 00219 int iradius = (int) (radius + 0.5); 00220 00221 /* Examine all points from the gradient image that could lie within the 00222 index square. 00223 */ 00224 for (int i = -iradius; i <= iradius; i++) 00225 for (int j = -iradius; j <= iradius; j++) { 00226 00227 /* Rotate sample offset to make it relative to key orientation. 00228 Uses (row,col) instead of (x,y) coords. Also, make subpixel 00229 correction as later image offset must be an integer. Divide 00230 by spacing to put in index units. 00231 */ 00232 rpos = ((cosinus * i + sinus * j) - (row - irow)) / spacing; 00233 cpos = ((- sinus * i + cosinus * j) - (col - icol)) / spacing; 00234 00235 // these above are relative to the center of the patch, and also 00236 // normalized to a "unit distance" (e.g. we can just put in a 00237 // gaussian now) 00238 // simplified (compensates for deviation from integer positions): 00239 // rpos = (i - (row - irow)) / spacing; 00240 // cpos = (j - (col - icol)) / spacing; 00241 00242 /* Compute location of sample in terms of real-valued index array 00243 coordinates. Subtract 0.5 so that rx of 1.0 means to put full 00244 weight on index[1] (e.g., when rpos is 0 and INDEX_SIZE is 3. 00245 */ 00246 rx = rpos + INDEX_SIZE / 2.0 - 0.5; 00247 cx = cpos + INDEX_SIZE / 2.0 - 0.5; 00248 00249 /* Test whether this sample falls within boundary of index patch. */ 00250 if((rx > -1.0) && (rx < (Real64) INDEX_SIZE) && 00251 (cx > -1.0) && (cx < (Real64) INDEX_SIZE)) 00252 InternalCount(descriptor, magnitude, direction, irow + i, icol + j, rpos, cpos, 00253 rx, cx, pointOrientation); 00254 } 00255 }
Here is the call graph for this function:
|