2d convolution using python and numpy

前端 未结 7 940
鱼传尺愫
鱼传尺愫 2020-12-05 15:48

I am trying to perform a 2d convolution in python using numpy

I have a 2d array as follows with kernel H_r for the rows and H_c for the columns

data          


        
7条回答
  •  醉酒成梦
    2020-12-05 15:57

    Since you already have your kernel separated you should simply use the sepfir2d function from scipy:

    from scipy.signal import sepfir2d
    convolved = sepfir2d(data, H_r, H_c)
    

    On the other hand, the code you have there looks all right ...

提交回复
热议问题