示例#1
0
def draw_matches_file(im1, im2, ip1, ipm, filename):
    """
  Draw matches ip1, ipm on images im1, im2 and save to filename
  """
    H1, W1, B1 = im1.shape
    H2, W2, B2 = im2.shape

    im3 = np.zeros((max(H1, H2), W1 + W2, 3))
    im3[0:H1, 0:W1, :] = im1
    im3[0:H2, W1:(W1 + W2), :] = im2

    fig, ax = im_util.image_figure(im3)
    col_offset = W1

    for r1, c1, r2, c2 in zip(ip1[0, :], ip1[1, :], ipm[0, :], ipm[1, :]):
        rand_colour = np.random.rand(3, )

        circ1 = Circle((c1, r1), 5)
        circ1.set_color('black')
        circ2 = Circle((c1, r1), 3)
        circ2.set_color(rand_colour)
        ax.add_patch(circ1)
        ax.add_patch(circ2)

        circ3 = Circle((c2 + col_offset, r2), 5)
        circ3.set_color('black')
        circ4 = Circle((c2 + col_offset, r2), 3)
        circ4.set_color(rand_colour)
        ax.add_patch(circ3)
        ax.add_patch(circ4)

    fig.savefig(filename)
    plt.close(fig)
示例#2
0
def draw_interest_points_file(im, ip, filename):
    """
  Draw interest points ip on image im and save to filename
  """
    fig, ax = im_util.image_figure(im)
    draw_interest_points_ax(ip, ax)
    fig.savefig(filename)
    plt.close(fig)