| 223 | } |
| 224 | |
| 225 | void GetMagsAndOrients( // get mags and orients for patch at ix,iy |
| 226 | vec_double& mags, // out |
| 227 | vec_double& orients, // out |
| 228 | const int ix, // in: x coord of center of patch (may be off image) |
| 229 | const int iy, // in: y coord of center of patch (may be off image) |
| 230 | const int patchwidth, // in: in pixels |
| 231 | const MAT& magmat, // in |
| 232 | const MAT& orientmat, // in |
| 233 | const vec_double& pixelweights) // in |
| 234 | { |
| 235 | CV_Assert(patchwidth % 2 == 1); // patchwidth must be odd in this implementation |
| 236 | const int npix = SQ(patchwidth); // number of pixels in image patch |
| 237 | const int halfpatchwidth = (patchwidth-1) / 2; |
| 238 | |
| 239 | mags.resize(npix); |
| 240 | orients.resize(npix); |
| 241 | |
| 242 | if (ix - halfpatchwidth < 0 || ix + halfpatchwidth >= magmat.cols || |
| 243 | iy - halfpatchwidth < 0 || iy + halfpatchwidth >= magmat.rows) |
| 244 | { |
| 245 | // Part or all of the patch is out the image area. |
| 246 | |
| 247 | GetMagsAndOrients_GeneralCase(mags, orients, |
| 248 | ix, iy, patchwidth, magmat, orientmat, pixelweights); |
| 249 | } |
| 250 | else |
| 251 | { |
| 252 | // Patch is entirely in the image area. The following function returns |
| 253 | // results identical to GetMagsAndOrients_GeneralCase, but is faster |
| 254 | // because it doesn't have to worry about the edges of the image. |
| 255 | |
| 256 | GetMagsAndOrients_AllInImg(mags, orients, |
| 257 | ix, iy, patchwidth, magmat, orientmat, pixelweights); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // Apportion the gradient magnitude of a pixel across 8 orientation bins. |
| 262 | // "Accumulate" is in the func name because we "+=" the interpolated values. |
no test coverage detected