0

I am having difficulty getting a black grid+border on the image

I tried many ways but nothing is working properly. Either only the first image. I want all images to be grid-like, I have them in the middle.

fig, axs = plt.subplots(1, 3, figsize=(15, 15))

#cc = 'red'

axs[0].imshow(img_test, cmap=cmapwhite,label=img_test)
axs[0].set_title('Original')
axs[0].axis('off')

for i in range(5):
    for j in range(5):
        c = int(img_test[j, i])
        axs[0].grid(linestyle='-', linewidth='0.5', color='red')

        axs[0].text(i, j, str(c), va='center', ha='center', color=colorblack, style='oblique')

        
axs[1].imshow(img_gaussiankernel, cmap=cmapwhite,label=denoised_gaussian)
axs[1].set_title('      Gaussian Filter(3x3)\n')
axs[1].axis('off')



axs[2].imshow(denoised_gaussian,cmap=cmapwhite, label=denoised_gaussian)
axs[2].set_title('Filtered Image')
axs[2].axis('off')

for i in range(5):
    for j in range(5):
        if(denoised_gaussian[j, i]==0):
            c = int(denoised_gaussian[j, i])
            cc = 'red'
        else:
            c = int(denoised_gaussian[j, i])
            cc = 'gold'
        axs[2].text(i, j, str(c), va='center', ha='center', color=colorblack)

fig.savefig("gaussianfilter.svg", format="svg", dpi=1200, bbox_inches='tight')

enter image description here

Milan
  • 687
  • 7
  • 15
  • What do you mean you want the border to be black? IF you want to force an n pixel border. use a mask. Otherwise consider simply expanding your image with a black border. Or if you mean to convolve your filter such that the orginal becomes filtered image....... Could you include your input image as well as a rough sketch of what you mean if not any of the above. – Jason Chia Jan 25 '23 at 15:54

0 Answers0