def main():
    from matplotlib import pyplot as plt
    w = (2 * 640)
    h = (2 * 480)
    n = (2 * 1024)
    di = 8
    dj = 32
    track = Tracker()
    img1 = np.random.randint(0, 255, size=(h, w, 3), dtype=np.uint8)
    img2 = np.roll(img1, di, axis=0)
    img2 = np.roll(img2, dj, axis=1)
    pt1 = np.random.uniform((0, 0), (w, h), size=(n, 2)).astype(np.float32)
    (pt2, idx) = track(img1, img2, pt1)
    (fig, ax) = plt.subplots(1, 2)
    ax[0].imshow(img1, alpha=0.5)
    ax[0].plot(pt1[:, 0], pt1[:, 1], 'r+')
    ax[1].imshow(img2, alpha=0.5)
    ax[1].plot(pt1[:, 0], pt1[:, 1], 'bx')
    ax[1].plot(pt2[:, 0], pt2[:, 1], 'r+')
    plt.show()
def main():
    from matplotlib import pyplot as plt
    w = (2 * 640)
    h = (2 * 480)
    n = (2 * 1024)
    di = 8
    dj = 32
    track = Tracker()
    img1 = np.random.randint(0, 255, size=(h, w, 3), dtype=np.uint8)
    img2 = np.roll(img1, di, axis=0)
    img2 = np.roll(img2, dj, axis=1)
    pt1 = np.random.uniform((0, 0), (w, h), size=(n, 2)).astype(np.float32)
    (pt2, idx) = track(img1, img2, pt1)
    (fig, ax) = plt.subplots(1, 2)
    ax[0].imshow(img1, alpha=0.5)
    ax[0].plot(pt1[:, 0], pt1[:, 1], 'r+')
    ax[1].imshow(img2, alpha=0.5)
    ax[1].plot(pt1[:, 0], pt1[:, 1], 'bx')
    ax[1].plot(pt2[:, 0], pt2[:, 1], 'r+')
    plt.show()