Ejemplo n.º 1
0
def test_dct():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100. * data / np.amax(data)
    y = data + np.random.normal(0, 20, data.shape)
    y = y.astype(np.float32)

    out = dct_8x8(y, 60)
    outs = [calcPSNR(data, dct_8x8(y, s)) for s in np.linspace(10, 60, 20)]
    return out
Ejemplo n.º 2
0
def test_bilateral():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100.*data/np.amax(data)
    y = data + np.random.normal(0,20,data.shape)
    y = y.astype(np.float32)

    outs  = [calcPSNR(data,bilateral(y,2,sigs)) for sigs in np.linspace(1.,200,20)]

    return outs
Ejemplo n.º 3
0
def test_dct():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100.*data/np.amax(data)
    y = data + np.random.normal(0,20,data.shape)
    y = y.astype(np.float32)

    out = dct_8x8(y,60)
    outs  = [calcPSNR(data,dct_8x8(y,s)) for s in np.linspace(10,60,20)]
    return out
Ejemplo n.º 4
0
def test_bilateral():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100. * data / np.amax(data)
    y = data + np.random.normal(0, 20, data.shape)
    y = y.astype(np.float32)

    outs = [
        calcPSNR(data, bilateral(y, 2, sigs))
        for sigs in np.linspace(1., 200, 20)
    ]

    return outs
Ejemplo n.º 5
0
def test_nlm():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100. * data / np.amax(data)
    y = data + np.random.normal(0, 20, data.shape)
    y = y.astype(np.float32)

    out = nlm(y, 2, 3, 25.)
    sigs = np.linspace(2, 70, 10)

    outs = [calcPSNR(data, nlm(y, 2, 3, s)) for s in sigs]
    print "nlm: sig_max = %s" % sigs[np.argmax(outs)]

    return outs
Ejemplo n.º 6
0
def test_nlm():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100.*data/np.amax(data)
    y = data + np.random.normal(0,20,data.shape)
    y = y.astype(np.float32)

    out = nlm(y,2,3,25.)
    sigs = np.linspace(2,70,10)

    outs  = [calcPSNR(data,nlm(y,2,3,s)) for s in sigs]
    print "nlm: sig_max = %s" %sigs[np.argmax(outs)]

    return outs
Ejemplo n.º 7
0
def test_nlm_fast():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100. * data / np.amax(data)
    y = data + np.random.normal(0, 20, data.shape)
    y = y.astype(np.float32)

    out = nlm_fast(y, 2, 3, 5.)
    sigs = np.linspace(3, 70, 30)
    outs = [calcPSNR(data, nlm_fast(y, 2, 3, s)) for s in sigs]

    bests = []
    for s0 in np.linspace(2, 20, 10):
        y = data + np.random.normal(0, s0, data.shape)
        y = y.astype(np.float32)
        ind = np.argmax([calcPSNR(data, nlm_fast(y, 2, 3, s)) for s in sigs])
        print ind
        bests.append([s0, sigs[ind]])

    print "nlm fast: sig_max = %s" % sigs[np.argmax(outs)]
    return bests
Ejemplo n.º 8
0
def test_nlm_fast():
    from imgtools import test_images, calcPSNR

    data = test_images.lena()
    data = 100.*data/np.amax(data)
    y = data + np.random.normal(0,20,data.shape)
    y = y.astype(np.float32)

    out = nlm_fast(y,2,3,5.)
    sigs = np.linspace(3,70,30)
    outs  = [calcPSNR(data,nlm_fast(y,2,3,s)) for s in sigs]


    bests = []
    for s0 in np.linspace(2,20,10):
        y = data + np.random.normal(0,s0,data.shape)
        y = y.astype(np.float32)
        ind=np.argmax([calcPSNR(data,nlm_fast(y,2,3,s)) for s in sigs])
        print ind
        bests.append([s0,sigs[ind]])

    print "nlm fast: sig_max = %s" %sigs[np.argmax(outs)]
    return bests