- tasks = [(X[x], Y[x], im_l_s, a, b, c, d, s,
- v1, v2, k, hough, size) for x in xrange(0, 2 * k)]
-
- import time
- start = time.time()
- opt_ab = pool.map(job_br1, tasks, 1)
- opt_cd = pool.map(job_br2, tasks, 1)
- d1 = 0
- for lst in opt_ab:
- for tpl in lst:
- if tpl[0] > d1:
- d1 = tpl[0]
- a, b = tpl[1], tpl[2]
- d1 = 0
- for lst in opt_cd:
- for tpl in lst:
- if tpl[0] > d1:
- d1 = tpl[0]
- c, d = tpl[1], tpl[2]
- print time.time() - start
- grid = get_grid(a, b, c, d, hough, size)
- grid_lines = [[l2ad(l, size) for l in grid[0]],
- [l2ad(l, size) for l in grid[1]]]
-
- ###
-
- im_t = Image.new('RGB', im_l.size, None)
- im_t_l = im_t.load()
- im_l_l = im_l.load()
- for x in xrange(im_t.size[0]):
- for y in xrange(im_t.size[1]):
- im_t_l[x, y] = (im_l_l[x, y], 0, 0)
+ tasks = [(im_l_s, v1, v2, h1, h2, x, y, delta_v, delta_h, size) for (x, y) in
+ itertools.product(xrange(-k, k), xrange(-k, k))]