Wave-based Non-Line-of-Sight Imaging in Julia


Wave-based Non-Line-of-Sight Imaging in Julia

function stoltLinearInterpZ(A, x, y, z)
  zLow  = floor(Int, z)
  zHigh = ceil(Int, z)
  low   = 1 <= zLow  <= size(A, 3) ? A[x, y, zLow] : 0
  high  = 1 <= zHigh <= size(A, 3) ? A[x, y, zHigh] : 0
  return low*(zHigh-z) + high*(z-zLow)
end

function stoltInterp(A, x, y, z; physX, physY, resT)
  i = 2*(x-1)/size(A, 1) - 1
  j = 2*(y-1)/size(A, 2) - 1
  k = 2*(z-1)/size(A, 3) - 1

  i *= (size(A, 1)/2*c*resT) / (4*(physX/2))
  j *= (size(A, 2)/2*c*resT) / (4*(physY/2))

  l = sqrt(i^2 + j^2 + k^2)
  f = (l + 1)*size(A, 3)/2 + 1
  S = max(c/2 * k/max(l, eps()), 0)
  return k > 0 ? S*stoltLinearInterpZ(A, x, y, f) : 0
end

Phi = zero(PhiBar)
for K_x in 1:size(Phi, 1), K_y in 1:size(Phi, 2), K_z in 1:size(Phi, 3)
  Phi[K_x, K_y, K_z] = stoltInterp(PhiBar, K_x, K_y, K_z, physX = 2, physY = 2, resT = 32e-12)
end


Source link