image processing style (2D kernel) convolutions?

Jeff Epler jepler at unpythonic.net
Tue Mar 2 21:02:06 EST 2004


Well, it seems that you could convolve each row of the input image with
each row of the kernel, with the rows offset from each other.  Then sum
the 3 convolved rows to get the output row

I know this isn't the right notation, and doesn't deal with r-1 or r+1
being out of range..
    for r in range(input_height):
        output[r] = (convolve(input[r-1], filter[0]) 
                  + convolve(input[r], filter[1])
                  + convolve(input[r+1], filter[2])

Jeff




More information about the Python-list mailing list