Ejemplo n.º 1
0
 def goOnce(v1,v2):
   t11,t12,t22 = like(g11),like(g12),like(g22)
   v = getAnglesFromGradients(v1,v2)
   sigmaS = 24.0 # spatial filter sigma
   sigmaR = computeSigmaR(v1)
   blf = BilateralFilter(sigmaS,sigmaR)
   blf.setType(BilateralFilter.Type.TUKEY_ANGLE)
   blf.applyABC(g,v,g11,t11)
   blf.applyABC(g,v,g12,t12)
   blf.applyABC(g,v,g22,t22)
   u1,u2,_,_,_,_ = getEigenFromTensors(t11,t12,t22)
   return u1,u2
Ejemplo n.º 2
0
def goFilterImpulses():
    xa, s1, s2, clip = getImage()
    xb = makeImpulses(12, len(xa[0]), len(xa))
    t = diffusionTensors(2.0, xa)
    plot(xa, s1, s2, 1.3)
    #plot(xb,s1,s2,0.9)
    for sigmaR in [0.1, 1.0, 100.0]:
        #for sigmaR in [100.0]:
        y = like(xa)
        bf = BilateralFilter(30.0, sigmaR)
        bf.setType(BilateralFilter.Type.TUKEY)
        bf.applyAB(t, xa, xb, y)
        y = smoothS(y)
        #plot(y,s1,s2,0.5*max(y))
        plot(y, s1, s2, 0.1)
Ejemplo n.º 3
0
def goFilterImpulses():
  xa,s1,s2,clip = getImage()
  xb = makeImpulses(12,len(xa[0]),len(xa))
  t = diffusionTensors(2.0,xa)
  plot(xa,s1,s2,1.3)
  #plot(xb,s1,s2,0.9)
  for sigmaR in [0.1,1.0,100.0]:
  #for sigmaR in [100.0]:
    y = like(xa)
    bf = BilateralFilter(30.0,sigmaR)
    bf.setType(BilateralFilter.Type.TUKEY)
    bf.applyAB(t,xa,xb,y)
    y = smoothS(y)
    #plot(y,s1,s2,0.5*max(y))
    plot(y,s1,s2,0.1)
Ejemplo n.º 4
0
def goFilterRandom():
    xa, s1, s2, clip = getImage()
    plot(xa, s1, s2, clip)
    n1, n2 = len(xa[0]), len(xa)
    xb = makeRandom(n1, n2)
    t = diffusionTensors(2.0, xa)
    #plot(xa,s1,s2,1.3)
    #plot(xb,s1,s2,0.5)
    xqqd = qqd(x)
    for sigmaR in [xqqd, 100 * xqqd]:
        y = like(xa)
        bf = BilateralFilter(30.0, sigmaR)
        bf.setType(BilateralFilter.Type.TUKEY)
        bf.applyAB(t, xa, xb, y)
        plot(y, s1, s2, 0.1)
        bf.apply(t, xa, y)
        plot(y, s1, s2, clip)
Ejemplo n.º 5
0
def goFilterRandom():
  xa,s1,s2,clip = getImage()
  plot(xa,s1,s2,clip)
  n1,n2 = len(xa[0]),len(xa)
  xb = makeRandom(n1,n2)
  t = diffusionTensors(2.0,xa)
  #plot(xa,s1,s2,1.3)
  #plot(xb,s1,s2,0.5)
  xqqd = qqd(x)
  for sigmaR in [xqqd,100*xqqd]:
    y = like(xa)
    bf = BilateralFilter(30.0,sigmaR)
    bf.setType(BilateralFilter.Type.TUKEY)
    bf.applyAB(t,xa,xb,y)
    plot(y,s1,s2,0.1)
    bf.apply(t,xa,y)
    plot(y,s1,s2,clip)
Ejemplo n.º 6
0
def goRandomBlocks():
    n1 = 801
    x = makeBlocks(n1)
    plotB(x, x, -12, 12, "rbx")
    return
    y = add(x, makeNoiseForBlocks(3141, 8.0, 3.0, n1))
    plotB(x, y, -12, 12, "rbxy")
    sigmaS = 20.0
    yqqd = qqd(y)
    z = zerofloat(n1)
    for scale in [0.01, 0.5, 1.0, 1.5, 10, 100.0]:
        sigmaX = scale * yqqd
        print "sigmaS =", sigmaS, " sigmaX =", sigmaX
        bf = BilateralFilter(sigmaS, sigmaX)
        bf.setType(BilateralFilter.Type.TUKEY)
        bf.apply(y, z)
        png = "rbxz" + str(int(scale * 10 + 0.5))
        if len(png) == 1: png = "0" + png
        plotB(x, z, -12, 12, png=png)
Ejemplo n.º 7
0
def goRandomBlocks():
  n1 = 801
  x = makeBlocks(n1)
  plotB(x,x,-12,12,"rbx")
  return
  y = add(x,makeNoiseForBlocks(3141,8.0,3.0,n1))
  plotB(x,y,-12,12,"rbxy")
  sigmaS = 20.0
  yqqd = qqd(y)
  z = zerofloat(n1)
  for scale in [0.01,0.5,1.0,1.5,10,100.0]:
    sigmaX = scale*yqqd
    print "sigmaS =",sigmaS," sigmaX =",sigmaX
    bf = BilateralFilter(sigmaS,sigmaX)
    bf.setType(BilateralFilter.Type.TUKEY)
    bf.apply(y,z)
    png = "rbxz"+str(int(scale*10+0.5))
    if len(png)==1: png = "0"+png
    plotB(x,z,-12,12,png=png)