0

Is there an easy elegant way to do a 3x3 convolution just by using numpy (no scipy.ndimage allowed)?

For example, suppose I have following 2-D array

array([[ 0,  3,  6,  9],
       [12, 15, 18, 21],
       [24, 27, 30, 33],
       [36, 39, 42, 45]])

I want to produce following sum of neighbors using (3x3) convolution and 0 padding

array([[ 30,  54,  72,  54],
       [ 81, 135, 162, 117],
       [153, 243, 270, 189],
       [126, 198, 216, 150]])
ASR
  • 1
  • 1

0 Answers0