+
+ #let's try the bruteforce aproach:
+ s = 0.001
+ k = 50
+ X, Y = [], []
+ for i in range(-k, k):
+ X.append(range(-k, k))
+ Y.append(2*k*[i])
+
+ tasks = [(X[x], Y[x], im_l, a, b, c, d, s, v1, v2, k, hough, size) for x in xrange(0, 2 * k)]
+
+ pool = multiprocessing.Pool(None)
+
+ #start = time.time()
+ opt_ab = pool.map(job_br1, tasks, 1)
+ opt_cd = pool.map(job_br2, tasks, 1)
+ an, bn, cn, dn = 4 * [0]
+ d1 = 0
+ for lst in opt_ab:
+ for tpl in lst:
+ if tpl[0] > d1:
+ d1 = tpl[0]
+ an, bn = tpl[1], tpl[2]
+ d1 = 0
+ for lst in opt_cd:
+ for tpl in lst:
+ if tpl[0] > d1:
+ d1 = tpl[0]
+ cn, dn = tpl[1], tpl[2]
+ #print time.time() - start
+ grid = get_grid(an, bn, cn, dn, hough, size)
+ grid_lines = [[l2ad(l, size) for l in grid[0]], [l2ad(l, size) for l in grid[1]]]
+ return grid, grid_lines
+
+ #old optimization experiments: