projekty
/
imago.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix bugs in gridf3
[imago.git]
/
src
/
gridf3.py
diff --git
a/src/gridf3.py
b/src/gridf3.py
index
bdf3a82
..
89c24a9
100644
(file)
--- a/
src/gridf3.py
+++ b/
src/gridf3.py
@@
-69,6
+69,9
@@
class Point:
def __len__(self):
return 2
def __len__(self):
return 2
+ def to_tuple(self):
+ return (self.x, self.y)
+
class Line:
def __init__(self, (a, b, c)):
self.a, self.b, self.c = (a, b, c)
class Line:
def __init__(self, (a, b, c)):
self.a, self.b, self.c = (a, b, c)
@@
-103,7
+106,7
@@
def gen_corners(d1, d2):
c2 = [p for p in d2.points if p in c1.l1.points][0]
c3 = [p for p in d1.points if p in c2.l2.points][0]
c4 = [p for p in d2.points if p in c3.l1.points][0]
c2 = [p for p in d2.points if p in c1.l1.points][0]
c3 = [p for p in d1.points if p in c2.l2.points][0]
c4 = [p for p in d2.points if p in c3.l1.points][0]
- yield
[c1, c2, c3, c4]
+ yield
map(lambda p: p.to_tuple(), [c1, c2, c3, c4])
def dst(p, l):
(x, y), (a, b, c) = p, ransac.points_to_line(*l)
def dst(p, l):
(x, y), (a, b, c) = p, ransac.points_to_line(*l)
@@
-115,7
+118,6
@@
def score(lines, points):
s = min(map(lambda l: dst(p, l), lines))
s = min(s, 2)
score += s
s = min(map(lambda l: dst(p, l), lines))
s = min(s, 2)
score += s
- print score
return score
return score