6 # Calculates the total error in coordinates of GPU bounds rectangles of objects
8 def ComputeError(reference, other):
9 if type(reference) == str:
10 reference = open(reference, "r")
11 if type(other) == str:
12 other = open(other, "r")
16 a = reference.readline()
18 if a == "" and b == "":
22 if a[0] == '#' and b[0] == '#':
24 a = map(float, a.strip(" \r\n").split("\t"))
25 b = map(float, b.strip(" \r\n").split("\t"))
26 deltaArea = abs(b[3]*b[4] - a[3]*a[4])
28 deltaCoord = b[1] - a[1] + b[2] - a[2]
29 total += math.sqrt(deltaArea) + abs(deltaCoord)
31 # Counts the number of unique bounds
32 def UniqueBounds(other):
33 other = open(other, "r")
35 for l in other.readlines():
38 #print "L is " + str(l)
39 l = map(float, l.strip(" \r\n").split("\t"))
41 if not l in store.keys():
46 return len(store.keys())
49 print str(ComputeError(argv[1], argv[2])) + "\t" + str(UniqueBounds(argv[1])) + "\t" + str(UniqueBounds(argv[2]))
53 if __name__ == "__main__":
54 sys.exit(main(sys.argv))