I have two large grayscale images. Either PIL.Image or numpy data structure.
How do I do 1d convolution of the two images along one axis?
The best I come up with is
def conv2(im1, im2, *args):
res = 0
for l1, l2 in zip(im1, im2):
res += np.convolve(l1, l2, *args)
return res
Which works, but not extremely fast. Is there a faster way?
Please note that all the 2D convolution functions are probably not relevant since I am not interested in a 2D convolution. I've seen this question on SO before, but I didn't see a better answer than my code. So I'm bumping it again.