(img, filters, threadn = 8)
| 39 | return accum |
| 40 | |
| 41 | def process_threaded(img, filters, threadn = 8): |
| 42 | accum = np.zeros_like(img) |
| 43 | def f(kern): |
| 44 | return cv2.filter2D(img, cv2.CV_8UC3, kern) |
| 45 | pool = ThreadPool(processes=threadn) |
| 46 | for fimg in pool.imap_unordered(f, filters): |
| 47 | np.maximum(accum, fimg, accum) |
| 48 | return accum |
| 49 | |
| 50 | if __name__ == '__main__': |
| 51 | import sys |