Esempio n. 1
0
def test_errors():

    P = np.array([[1, 1], [2, 1]])
    Q = np.array([[2, 2], [0, 1], [2, 4]])
    with pytest.raises(ValueError):
        assert frdist(P, Q) == 2.0

    P = np.array([])
    Q = np.array([[2, 2], [0, 1], [2, 4]])
    with pytest.raises(ValueError):
        assert frdist(P, Q) == 2.0
Esempio n. 2
0
def test_errors():

    P = [[1, 1], [2, 1]]
    Q = [[2, 2], [0, 1], [2, 4]]
    with pytest.raises(ValueError):
        assert frdist(P, Q) == 2.0

    P = []
    Q = [[2, 2], [0, 1], [2, 4]]
    with pytest.raises(ValueError):
        assert frdist(P, Q) == 2.0
Esempio n. 3
0
def test_main():
    for test_case in test_cases:
        P = test_case['P']
        Q = test_case['Q']
        eo = test_case['expected']

        assert frdist(P, Q) == eo
Esempio n. 4
0
print("Hausdorf")
print(Hausdorf)
print("Len of Hausdorf")
print(len(Hausdorf))
Filename.append("101.jpg")
print(Filename)
data = {'Hausdorf': Hausdorf, 'ID': Filename}
NS = pd.DataFrame(data)

#METHOD2 - FRECHET DISTANCE
#Frechet Distance
s = u1.shape
v1.resize(s)
Frechet = []
Filename1 = []
##METHOD1 - FRECHET'S DISTANCE
f = frdist(u1, v1)
print("Frechet's distance")
print(f)
Frechet.append(f)
print("Frechet")
print(Frechet)
print("Len of Frechet")
print(len(Frechet))
Filename1.append("101.jpg")
print(Filename1)
NS['Frechet'] = f

#Write out the dataframe to an excel file
NS.to_csv(r"101_HF.csv", index=False, header=True)
Esempio n. 5
0
[40,12.76868]]

b = [[5,0.05411],
[10,0.03746],
[15,1.38599],
[20,3.86277],
[25,6.08305],
[30,2.54065],
[35,3.54065],
[40,15.17554]]

c = [[5,0.17903],
[10,5.04448],
[15,18.06757],
[20,26.50588],
[25,17.93629],
[30,15.93676],
[35,11.99633],
[40,7.2321]]

d = [[5,2.03744],
[10,3.93495],
[15,29.31478],
[20,23.28149],
[25,10.98102],
[30,19.96778],
[35,9.04275],
[40,5.30423]]

print frdist(d, c)