projekty
/
imago.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
even more robust gridf3
[imago.git]
/
src
/
gridf2.py
diff --git
a/src/gridf2.py
b/src/gridf2.py
index
0d9246f
..
0988508
100644
(file)
--- a/
src/gridf2.py
+++ b/
src/gridf2.py
@@
-51,7
+51,7
@@
def score(grid, lines, limit):
ds = map(dsg, grid)
d = max(map(abs, ds))
if d > limit:
ds = map(dsg, grid)
d = max(map(abs, ds))
if d > limit:
- return
999999
+ return
float("inf")
score = 0
for line in lines:
s = min(map(lambda g: abs(line[1] - g), ds))
score = 0
for line in lines:
s = min(map(lambda g: abs(line[1] - g), ds))
@@
-109,9
+109,9
@@
def test():
while True:
t0 = time.time()
while True:
t0 = time.time()
- sc1, gridv =
999999
, None
- sc2, gridh =
999999
, None
- sc1_n, sc2_n =
999999, 999999
+ sc1, gridv =
float("inf")
, None
+ sc2, gridh =
float("inf")
, None
+ sc1_n, sc2_n =
float("inf"), float("inf")
gridv_n, gridh_n = None, None
for k in range(50):
for i in range(5):
gridv_n, gridh_n = None, None
for k in range(50):
for i in range(5):
@@
-181,7
+181,7
@@
def test():
def find(lines, size, l1, l2, bounds, hough, show_all, do_something, logger):
logger("finding the grid")
l1, l2 = lines
def find(lines, size, l1, l2, bounds, hough, show_all, do_something, logger):
logger("finding the grid")
l1, l2 = lines
- sc1, gridv =
999999
, None
+ sc1, gridv =
float("inf")
, None
for i in range(250):
l1s = random.sample(l1, 2)
l1s.sort(key=lambda l: l[1])
for i in range(250):
l1s = random.sample(l1, 2)
l1s.sort(key=lambda l: l[1])
@@
-194,7
+194,7
@@
def find(lines, size, l1, l2, bounds, hough, show_all, do_something, logger):
if sc1_n < sc1:
sc1, gridv = sc1_n, gridv_n
if sc1_n < sc1:
sc1, gridv = sc1_n, gridv_n
- sc2, gridh =
999999
, None
+ sc2, gridh =
float("inf")
, None
for i in range(250):
l2s = random.sample(l2, 2)
l2s.sort(key=lambda l: l[1])
for i in range(250):
l2s = random.sample(l2, 2)
l2s.sort(key=lambda l: l[1])