VL_INLINE void _vl_dsift_with_flat_window (VlDsiftFilter* self) { int binx, biny, bint ; int framex, framey ; /* for each orientation bin */ for (bint = 0 ; bint < self->geom.numBinT ; ++bint) { vl_imconvcoltri_vf (self->convTmp1, self->imHeight, self->grads [bint], self->imWidth, self->imHeight, self->imWidth, self->geom.binSizeY - 1, /* filt size */ 1, /* subsampling step */ VL_PAD_BY_CONTINUITY|VL_TRANSPOSE) ; vl_imconvcoltri_vf (self->convTmp2, self->imWidth, self->convTmp1, self->imHeight, self->imWidth, self->imHeight, self->geom.binSizeX - 1, 1, VL_PAD_BY_CONTINUITY|VL_TRANSPOSE) ; for (biny = 0 ; biny < self->geom.numBinY ; ++biny) { for (binx = 0 ; binx < self->geom.numBinX ; ++binx) { float *dst = self->descrs + bint + binx * self->geom.numBinT + biny * (self->geom.numBinX * self->geom.numBinT) ; float *src = self->convTmp2 ; int frameSizeX = self->geom.binSizeX * (self->geom.numBinX - 1) + 1 ; int frameSizeY = self->geom.binSizeY * (self->geom.numBinY - 1) + 1 ; int descrSize = vl_dsift_get_descriptor_size (self) ; for (framey = self->boundMinY ; framey <= self->boundMaxY - frameSizeY + 1 ; framey += self->stepY) { for (framex = self->boundMinX ; framex <= self->boundMaxX - frameSizeX + 1 ; framex += self->stepX) { *dst = src [(framex + binx * self->geom.binSizeX) * 1 + (framey + biny * self->geom.binSizeY) * self->imWidth] ; dst += descrSize ; } /* framex */ } /* framey */ } /* binx */ } /* biny */ } /* bint */ }
VL_INLINE void _vl_dsift_with_flat_window (VlDsiftFilter* self) { int binx, biny, bint ; int framex, framey ; /* for each orientation bin */ for (bint = 0 ; bint < self->geom.numBinT ; ++bint) { vl_imconvcoltri_vf (self->convTmp1, self->imHeight, self->grads [bint], self->imWidth, self->imHeight, self->imWidth, self->geom.binSizeY, /* filt size */ 1, /* subsampling step */ VL_PAD_BY_CONTINUITY|VL_TRANSPOSE) ; vl_imconvcoltri_vf (self->convTmp2, self->imWidth, self->convTmp1, self->imHeight, self->imWidth, self->imHeight, self->geom.binSizeX, 1, VL_PAD_BY_CONTINUITY|VL_TRANSPOSE) ; for (biny = 0 ; biny < self->geom.numBinY ; ++biny) { float wy = _vl_dsift_get_bin_window_mean (self->geom.binSizeY, self->geom.numBinY, biny, self->windowSize) ; /* The convolution function uses triangualr wave with unit integral (hence height * equal to half the bin size). Instead * for SIFT the triangular wave is used as a partition function and must * have unit maximum. We compoensate for this by multiplying the result * by the bin size. */ wy *= self->geom.binSizeY ; for (binx = 0 ; binx < self->geom.numBinX ; ++binx) { float w ; float wx = _vl_dsift_get_bin_window_mean (self->geom.binSizeX, self->geom.numBinX, binx, self->windowSize) ; float *dst = self->descrs + bint + binx * self->geom.numBinT + biny * (self->geom.numBinX * self->geom.numBinT) ; float *src = self->convTmp2 ; int frameSizeX = self->geom.binSizeX * (self->geom.numBinX - 1) + 1 ; int frameSizeY = self->geom.binSizeY * (self->geom.numBinY - 1) + 1 ; int descrSize = vl_dsift_get_descriptor_size (self) ; wx *= self->geom.binSizeX ; w = wx * wy ; for (framey = self->boundMinY ; framey <= self->boundMaxY - frameSizeY + 1 ; framey += self->stepY) { for (framex = self->boundMinX ; framex <= self->boundMaxX - frameSizeX + 1 ; framex += self->stepX) { *dst = w * src [(framex + binx * self->geom.binSizeX) * 1 + (framey + biny * self->geom.binSizeY) * self->imWidth] ; dst += descrSize ; } /* framex */ } /* framey */ } /* binx */ } /* biny */ } /* bint */ }