OiO.lk Blog python Convolve2d (Scipy): Treatment of Boundary Values
python

Convolve2d (Scipy): Treatment of Boundary Values


I am performing an averaging procedure where I want to average each element of a two-dimensional array over a field of 250x250 elements. I use:

A=u
kernel = np.ones((250, 250), dtype="int")
B = (convolve2d(A, kernel, mode="same")/convolve2d(np.ones_like(A), kernel, mode="same"))

with A.shape=(637, 589). When I plot the field, there appears a white frame near the edges. I assume that this is due to a wrong treatment of the boundary values.

Is the calculation that I perform correct? Is it possible to treat the boundary elements in a different way such that the structures remain visible?



You need to sign in to view this answers

Exit mobile version