コード例 #1
0
ファイル: sifttestsuite.py プロジェクト: chrisdawgr/BARAP
def print_diffs(pic1, pic2, sift_or_surf):
    matches_1, matches_2 = removematches(pic1, pic2, sift_or_surf)
    orig_1 = h.points_ok(np.load(pic1[:-4] + ".npy"), sift_or_surf)
    orig_2 = h.points_ok(np.load(pic2[:-4] + ".npy"), sift_or_surf)
    print(matches_1)
    # print(orig_1)
    # print(orig_2)
    # print(matches_1)
    # print(matches_2)
    with open("detector-matches.txt", "a") as file:
        file.write(
            pic1
            + "\t"
            + str(orig_1[11])
            + "\t"
            + str(orig_1[12])
            + "\t"
            + str(orig_1[16])
            + "\t"
            + str(orig_1[17])
            + "\t"
            + str(matches_1[11])
            + "\t"
            + str(matches_1[12])
            + "\t"
            + str(matches_1[16])
            + "\t\t"
            + str(matches_1[17])
            + "\n"
        )

        file.write(
            pic2
            + "\t"
            + str(orig_2[11])
            + "\t"
            + str(orig_2[12])
            + "\t"
            + str(orig_2[16])
            + "\t"
            + str(orig_2[17])
            + "\t"
            + str(matches_2[11])
            + "\t"
            + str(matches_2[12])
            + "\t\t"
            + str(matches_2[16])
            + "\t\t"
            + str(matches_2[17])
            + "\n\n"
        )
コード例 #2
0
def print_diffs(pic1, pic2, sift_or_surf):
    matches_1, matches_2 = removematches(pic1, pic2, sift_or_surf)
    orig_1 = h.points_ok(np.load(pic1[:-4] + ".npy"), sift_or_surf)
    orig_2 = h.points_ok(np.load(pic2[:-4] + ".npy"), sift_or_surf)
    print(matches_1)
    #print(orig_1)
    #print(orig_2)
    #print(matches_1)
    #print(matches_2)
    with open("detector-matches.txt", "a") as file:
        file.write( \
            pic1 + "\t"
            + str(orig_1[11]) + "\t" + str(orig_1[12]) + "\t" \
            + str(orig_1[16]) + "\t" + str(orig_1[17]) + "\t" \
            + str(matches_1[11]) + "\t" + str(matches_1[12]) + "\t" \
            + str(matches_1[16]) + "\t\t" + str(matches_1[17]) + "\n")

        file.write( \
            pic2 + "\t"
            + str(orig_2[11]) + "\t" + str(orig_2[12]) + "\t" \
            + str(orig_2[16]) + "\t" + str(orig_2[17]) + "\t" \
            + str(matches_2[11]) + "\t" + str(matches_2[12]) + "\t\t" \
            + str(matches_2[16]) + "\t\t" + str(matches_2[17]) + "\n\n")
コード例 #3
0
def removematches(pic1, pic2, sift_or_surf):
    fn1 = pic1[:-4]
    px = np.load(fn1 + "onenn-p.npy")
    p1 = px[0]
    p2 = px[1]
    print("this is len p1:", len(p1))
    half_p = len(p1) / 4
    (p1, p2) = h.remove_bad_matches(p1, p2)
    matches1 = h.points_ok(p1, sift_or_surf)
    matches2 = h.points_ok(p2, sift_or_surf)
    h.drawMatches2(pic1, p1, pic2, p2, [])
    #h.drawMatches2(pic1, p1[:15], pic2, p2[:15], [])
    print("Number of matches: ", len(p1))
    with open("repeatabilitymeasure.txt", "a") as file:
        det1 = len(np.load(pic1[:-4] + ".npy"))
        det2 = len(np.load(pic2[:-4] + ".npy"))
        mean = (det1 + det2) / 2.0
        picn1 = "IMG" + "\\_" + pic1[4:-4] + ".jpg"
        picn2 = "IMG" + "\\_" + pic2[4:-4] + ".jpg"
        rep_mes = len(p1) / (mean * 1.0)
        file.write(picn1 + " &\t" + picn2 + " &\t" + str(det1) + " &\t" + str(det2) + " &\t" + str(mean) + \
        " &\t" + str(len(p1)) + " &\t" + str(rep_mes) + "\\\\ \hline\n")
    return (matches1, matches2)
コード例 #4
0
ファイル: sifttestsuite.py プロジェクト: chrisdawgr/BARAP
def removematches(pic1, pic2, sift_or_surf):
    fn1 = pic1[:-4]
    px = np.load(fn1 + "onenn-p.npy")
    p1 = px[0]
    p2 = px[1]
    print("this is len p1:", len(p1))
    half_p = len(p1) / 4
    (p1, p2) = h.remove_bad_matches(p1, p2)
    matches1 = h.points_ok(p1, sift_or_surf)
    matches2 = h.points_ok(p2, sift_or_surf)
    h.drawMatches2(pic1, p1, pic2, p2, [])
    # h.drawMatches2(pic1, p1[:15], pic2, p2[:15], [])
    print("Number of matches: ", len(p1))
    with open("repeatabilitymeasure.txt", "a") as file:
        det1 = len(np.load(pic1[:-4] + ".npy"))
        det2 = len(np.load(pic2[:-4] + ".npy"))
        mean = (det1 + det2) / 2.0
        picn1 = "IMG" + "\\_" + pic1[4:-4] + ".jpg"
        picn2 = "IMG" + "\\_" + pic2[4:-4] + ".jpg"
        rep_mes = len(p1) / (mean * 1.0)
        file.write(
            picn1
            + " &\t"
            + picn2
            + " &\t"
            + str(det1)
            + " &\t"
            + str(det2)
            + " &\t"
            + str(mean)
            + " &\t"
            + str(len(p1))
            + " &\t"
            + str(rep_mes)
            + "\\\\ \hline\n"
        )
    return (matches1, matches2)