Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please confirm PS(I,r) #54

Open
yellowlab9 opened this issue Jan 1, 2018 · 1 comment
Open

Please confirm PS(I,r) #54

yellowlab9 opened this issue Jan 1, 2018 · 1 comment

Comments

@yellowlab9
Copy link

Please confirm that the function

def PS(I, r):
  assert len(I.shape) == 3
  assert r>0
  r = int(r)
  O = np.zeros((I.shape[0]*r, I.shape[1]*r, I.shape[2]/(r*2)))
  for x in range(O.shape[0]):
    for y in range(O.shape[1]):
      for c in range(O.shape[2]):
        c += 1
        a = np.floor(x/r).astype("int")
        b = np.floor(y/r).astype("int")
        d = c*r*(y%r) + c*(x%r)
        print a, b, d
        O[x, y, c-1] = I[a, b, d]
  return O

does not implement the PS(T)_{x,y,c} :

In particular, the line in PS(I,r)

d = c*r*(y%r) + c*(x%r)

does not implement the index in PS(T)_{x,y,c}

C * r * mod(y,r) + C * mod(x,r) + c

where capital letter C and small letter c are two different things.

@zhufeida
Copy link

The python implementation of Phase Shift seems wrong. Here is my correction.
image

def PS(I, r):
    assert len(I.shape) == 3
    assert r>0
    r = int(r)
    O = np.zeros((I.shape[0]*r, I.shape[1]*r, int(I.shape[2]/(r**2))))
    for x in range(O.shape[0]):
        for y in range(O.shape[1]):
            for c in range(O.shape[2]):
                C = O.shape[2]
                a = np.floor(x/r).astype("int")
                b = np.floor(y/r).astype("int")
                d = C*r*(x%r) + C*(y%r) + c
                #print(a, b, d)
                O[x, y, c] = I[a, b, d]
    return O

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants