- k = len(buckets[i][j]) // 2
- offset = [(xc1 - xc0, yc1 - yc0) for xc0, yc0, xc1, yc1 in buckets[i][j]]
+ # correlate blocks in (i, j)-corner
+ blocks = []
+ for k in range(yb):
+ yc = k * BLOCK_SIZE + (BLOCKS + 1) * BLOCK_SIZE // 2
+ if i:
+ yc = ys - yc
+ for l in range(xb):
+ xc = l * BLOCK_SIZE + (BLOCKS + 1) * BLOCK_SIZE // 2
+ if j:
+ xc = xs - xc
+ offset = correlate(image0_bp, image1_bp, xc, yc)
+ if offset is not None:
+ x, y = offset
+ print('i', i, 'j', j, 'k', k, 'l', l, 'x', x, 'y', y)
+ blocks.append((xc, yc, xc + x, yc + y))
+
+ # find the trend in (i, j)-corner
+ k = len(blocks) // 2
+ offset = [(xc1 - xc0, yc1 - yc0) for xc0, yc0, xc1, yc1 in blocks]