def getHOGBlocks(rect, blocksizes, stride=1.0):
    """Returns a set of blocks (rects), with the given (fractional) stride among blocks"""
    x0, y0, x1, y1 = rect[:4]
    ret = []
    for b in blocksizes:
        ss = int(b*stride)
        for y in range(y0, y1+1, ss):
            if y+b-1 > y1: break
            for x in range(x0, x1+1, ss):
                if x+b-1 > x1: break
                ret.append([x, y, x+b-1, y+b-1]) # -1 to make it an inclusive box
    return ret