I'm trying to recover the surface shape of a body from fringe pattern. There's a interferometer projecting circular fringes on the body. A camera takes a picture of the reflection of these fringes. I studied some papers doing this with unwrapping the phase of the fringen pattern. Unfortunately they don't go very deep, so I didn't get the link between the unwrapped phase and the resulting topology.
First I created a test pattern function:
def create_pattern_rings(dim, count_rings):
pattern = np.zeros((dim[0], dim[1]))
pix_per_ring = int((dim[1] / 2) / count_rings)
for ring in range(0, count_rings):
radii_out = (dim[1] / 2) - ring*pix_per_ring*2
radii_in = radii_out - pix_per_ring
for y in range(0, dim[0]):
for x in range(0, dim[1]):
if (np.sqrt((x-dim[1]/2)**2 + (y-dim[1]/2)**2)) < radii_out and (np.sqrt((x-dim[1]/2)**2 + (y-dim[1]/2)**2)) > radii_in:
pattern[y][x] = 1
With this pattern I do 2D fft to get the phase with numpy.angle()
. This phase can be unwrapped using numpy.unwrap()
:
def calc_fft(data, shift):
data_fft = np.fft.fft2(data)
if shift:
data_fft = np.fft.fftshift(data_fft)
return data_fft
def phase_unwrap(data_fft):
data_unwraped = np.unwrap(np.angle(data_fft))
return data_unwraped
But I don't know how to go one after this step. Any suggestions?
Thanks!