Exemple #1
0
def preproc_dog(bg):
    """test low level image filter
    """

    #special dependencies
    from scipy.ndimage import gaussian_filter
    from pyrankfilter import rankfilter,__version__

    bg = bg.astype(float)
    f1 = gaussian_filter(bg,sigma=14.5)
    f2 = gaussian_filter(bg,sigma=15)

    f = ((f1-f2+3)*10).astype('uint8')

    loc_max = rankfilter(f,'highest',20,infSup=[0,0])

    r = bg.copy()
    r[loc_max>0]=0

    plt.figure()
    plt.subplot(2,2,1)
    plt.imshow(bg)
    plt.subplot(2,2,2)
    plt.imshow(f)
    plt.colorbar()
    plt.subplot(2,2,3)
    plt.imshow(loc_max)
    plt.subplot(2,2,4)
    plt.imshow(r)
    plt.show()
Exemple #2
0
def preproc(bg):
    """test low level image filter
    """

    #special dependencies
    from pyrankfilter import rankfilter,__version__

    print __version__

    #custom structuring element
    xx,yy = npy.meshgrid(npy.linspace(-50,50,100),npy.linspace(-50,50,100))
    zz = npy.sqrt(xx**2+yy**2)

    struct_elem = npy.logical_and(zz>10,zz<20)

    plt.figure()
    f = rankfilter(bg,'median',struct_elem=struct_elem.astype('uint8'))
    plt.imshow(f)
    plt.show()