python - matplotlib: Displaying an image as separate convolution regions -


i'm trying display image using matplotlib. want display said image series of subplots each subplot represents region used when performing valid convolution. example, image in first link 32x32 grayscale image. want perform convolution on image using 5x5 filter. in order see filter being convolved each time want split image separate overlapping 5x5 regions. code using follows:

fig14 = plt.figure(14) = images[4,0,:,:] in range(images.shape[3]-5+1): #counts 0 27 (28 = no of convolutions)     j in range(images.shape[3]-5+1): #counts 0 27        plt.subplot(28,28,(i*28)+j+1)        plt.gray        plt.axis("off")        plt.imshow(a[i:(i-1)+5,j:(j-1)+5]) 

the result in second link. don't understand why there black pixels in centre? surely should white. can tell me i'm going wrong? in advance.

input image

result


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -