- grid = get_grid(a, b, c, d, hough, size)
-
- #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])
-
- pool = multiprocessing.Pool(None)
-
- 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)
+ f_dist = partial(job_4, im_l=im_l_s, v1=v1, v2=v2, h1=h1, h2=h2,
+ dv=delta_v, dh=delta_h, size=size)