//! Calculate Haar wavelet responses in y direction float haarY(int row, int column, int s) { return(COpenSURF.Area(img, column - s / 2, row, s, s / 2) - 1 * COpenSURF.Area(img, column - s / 2, row - s / 2, s, s / 2)); }
void buildDet() { // Compute value for each position in the scale-space image. int lobe, border, step; float Dxx = 0, Dyy = 0, Dxy = 0, scale; int ixdet = 0; for (int o = 0; o < octaves; o++) { // calculate filter border for this octave border = (3 * COpenSURF.cvRound(COpenSURF.pow(2.0f, o + 1) * (intervals) + 1) + 1) / 2; step = init_sample * COpenSURF.cvRound(COpenSURF.pow(2.0f, o)); for (int i = 0; i < intervals; i++) { // calculate lobe length (filter side length/3) lobe = COpenSURF.cvRound(COpenSURF.pow(2.0f, o + 1) * (i + 1) + 1); scale = 1.0f / COpenSURF.pow((float)(3 * lobe), 2); for (int r = border; r < i_height - border; r += step) { for (int c = border; c < i_width - border; c += step) { /*** * Dyy = COpenSURF.Area(img, c - (lobe - 1), r - ((3 * lobe - 1) / 2), (2 * lobe - 1), lobe) * - 2 * COpenSURF.Area(img, c - (lobe - 1), r - ((lobe - 1) / 2), (2 * lobe - 1), lobe) + COpenSURF.Area(img, c - (lobe - 1), r + ((lobe + 1) / 2), (2 * lobe - 1), lobe); + + + Dxx = COpenSURF.Area(img, c - ((3 * lobe - 1) / 2), r - (lobe - 1), lobe, (2 * lobe - 1)) + - 2 * COpenSURF.Area(img, c - ((lobe - 1) / 2), r - (lobe - 1), lobe, (2 * lobe - 1)) + COpenSURF.Area(img, c + ((lobe + 1) / 2), r - (lobe - 1), lobe, (2 * lobe - 1)); + + Dxy = COpenSURF.Area(img, c - lobe, r - lobe, lobe, lobe) + COpenSURF.Area(img, c + 1, r + 1, lobe, lobe) + - COpenSURF.Area(img, c - lobe, r + 1, lobe, lobe) + - COpenSURF.Area(img, c + 1, r - lobe, lobe, lobe); ***/ { float dyy0 = COpenSURF.Area(img, c - (lobe - 1), r - ((3 * lobe - 1) / 2), (2 * lobe - 1), lobe); float dyy1 = COpenSURF.Area(img, c - (lobe - 1), r - ((lobe - 1) / 2), (2 * lobe - 1), lobe); float dyy2 = COpenSURF.Area(img, c - (lobe - 1), r + ((lobe + 1) / 2), (2 * lobe - 1), lobe); Dyy = dyy0 - 2 * dyy1 + dyy2; } { float dxx0 = COpenSURF.Area(img, c - ((3 * lobe - 1) / 2), r - (lobe - 1), lobe, (2 * lobe - 1)); float dxx1 = COpenSURF.Area(img, c - ((lobe - 1) / 2), r - (lobe - 1), lobe, (2 * lobe - 1)); float dxx2 = COpenSURF.Area(img, c + ((lobe + 1) / 2), r - (lobe - 1), lobe, (2 * lobe - 1)); Dxx = dxx0 - 2 * dxx1 + dxx2; } { float dxy0 = COpenSURF.Area(img, c - lobe, r - lobe, lobe, lobe); float dxy1 = COpenSURF.Area(img, c + 1, r + 1, lobe, lobe); float dxy2 = COpenSURF.Area(img, c - lobe, r + 1, lobe, lobe); float dxy3 = COpenSURF.Area(img, c + 1, r - lobe, lobe, lobe); Dxy = dxy0 + dxy1 - dxy2 - dxy3; } // Normalise the filter responses with respect to their size Dxx *= scale; Dyy *= scale; Dxy *= scale; // Get the sign of the laplacian int lap_sign = (Dxx + Dyy >= 0 ? 1 : -1); // Get the determinant of hessian response float res = (Dxx * Dyy - 0.9f * 0.9f * Dxy * Dxy); res = (res < thres ? 0 : lap_sign * res); // calculate approximated determinant of hessian value m_det[(o * intervals + i) * (i_width * i_height) + (r * i_width + c)] = res; ixdet += 1; if (res > 0) { } } } } } }