| 158 | // to 0 and thus contributes nothing later in TrilinearAccumulate. |
| 159 | |
| 160 | static void GetMagsAndOrients_GeneralCase( |
| 161 | vec_double& mags, // out |
| 162 | vec_double& orients, // out |
| 163 | const int ix, // in: x coord of center of patch |
| 164 | const int iy, // in: y coord of center of patch |
| 165 | const int patchwidth, // in |
| 166 | const MAT& magmat, // in |
| 167 | const MAT& orientmat, // in |
| 168 | const vec_double& pixelweights) // in |
| 169 | { |
| 170 | const int halfpatchwidth = (patchwidth-1) / 2; |
| 171 | int ipix = 0; |
| 172 | for (int x = iy - halfpatchwidth; x <= iy + halfpatchwidth; x++) |
| 173 | { |
| 174 | const double* const magbuf = Buf(magmat) + x * magmat.cols; |
| 175 | const double* const orientbuf = Buf(orientmat) + x * orientmat.cols; |
| 176 | |
| 177 | for (int y = ix - halfpatchwidth; y <= ix + halfpatchwidth; y++) |
| 178 | { |
| 179 | if (x < 0 || x >= magmat.rows || y < 0 || y >= magmat.cols) |
| 180 | { |
| 181 | mags[ipix] = 0; // off image |
| 182 | orients[ipix] = 0; |
| 183 | } |
| 184 | else // in image |
| 185 | { |
| 186 | mags[ipix] = pixelweights[ipix] * magbuf[y]; |
| 187 | orients[ipix] = orientbuf[y]; |
| 188 | } |
| 189 | ipix++; |
| 190 | } |
| 191 | } |
| 192 | CV_DbgAssert(ipix == NSIZE(mags)); |
| 193 | } |
| 194 | |
| 195 | // Calculate the image patch gradient mags and orients for |
| 196 | // an image patch that is entirely in the image boundaries. |
no test coverage detected