Gaussian Smoothing an image in python

后端 未结 1 1081
你的背包
你的背包 2021-02-07 12:13

I am very new to programming in python, and im still trying to figure everything out, but I have a problem trying to gaussian smooth or convolve an image. This is probably an ea

1条回答
  •  甜味超标
    2021-02-07 13:12

    Something like this perhaps?

    import numpy as np
    import scipy.ndimage as ndimage
    import matplotlib.pyplot as plt
    
    img = ndimage.imread('galaxies.png')
    plt.imshow(img, interpolation='nearest')
    plt.show()
    # Note the 0 sigma for the last axis, we don't wan't to blurr the color planes together!
    img = ndimage.gaussian_filter(img, sigma=(5, 5, 0), order=0)
    plt.imshow(img, interpolation='nearest')
    plt.show()
    

    enter image description here enter image description here

    (Original image taken from here)

    0 讨论(0)
提交回复
热议问题